4-Player Problem: Raw Input
Posted: Tue Jun 25, 2019 11:08 pm
I guess I posted this in the wrong forum earlier (LunaLua). My apologies. Been learning LunaLua for a couple of months now but have run into a problem I can't seem to work around. Would greatly appreciate any help.
The gist of my question is: Are there mem addresses for specific keyboard/controller buttons that AREN'T part of the onKeyboardPress function?
The longer story: I've been working on making a functional 4-player mode for SMBX. At this point, I'm able to create 4 players in a game through mem(0x00B2595E, FIELD_WORD, 4). The problem is, all 4 players are controlled by the keymap for player 1. In fact, if I start out in 2 player mode, and then add two more players, the inputs for player 2 revert from their own independent keycodes to being controlled by player 1. It could be that the base game thinks I'm using cloning cheat codes, which would explain why it's forcing everyone to be controlled by player 1. Let me be clear about the solutions I've attempted that haven't worked:
The gist of my question is: Are there mem addresses for specific keyboard/controller buttons that AREN'T part of the onKeyboardPress function?
The longer story: I've been working on making a functional 4-player mode for SMBX. At this point, I'm able to create 4 players in a game through mem(0x00B2595E, FIELD_WORD, 4). The problem is, all 4 players are controlled by the keymap for player 1. In fact, if I start out in 2 player mode, and then add two more players, the inputs for player 2 revert from their own independent keycodes to being controlled by player 1. It could be that the base game thinks I'm using cloning cheat codes, which would explain why it's forcing everyone to be controlled by player 1. Let me be clear about the solutions I've attempted that haven't worked:
- Overriding keycode constants (e.g. KEY_JUMP) or player-class constants (e.g. player.jumpKeyPressing) or directly altering player mem offsets (e.g. (Player(2):mem(0xF8, FIELD_BOOL)), in any shape or form, does NOT fix anything. I've messed with the script in classicevents, tried different functions (onTick, onInputUpdate, etc.), you name it. All of those constants are true/false variables--meaning, they don't change or even sense what keyboard/controller button is being pressed, only whether the already-defined key is pressed or not. The kind of script I would need to access (like the kind of changes that are made when using "options-->player 2 controls" in game) seems to take place within the .exe file and can't be touched. Bottom line: I can disable or change all the inputs for players 2-4, and they're genuinely altered, but it doesn't matter because once more than 2 players are in the game all player objects are bound to the player 1 controls.
- The config.dat file in SMBX seems directly related to changing the actual inputs for the game. The numbers in that file correspond to virtual key codes, and the game reads those numbers and changes them when the options controls are altered. But adding numbers to this file doesn't fix the problem, and I still have no access to the part of the program that actually reads that file and changes the game based on it.
- It seems that the script for the cheat code "supermario2" would be able to provide some answers. The cheat makes sure there are 2 player-objects in the game and allows a single player to toggle which character their input controls. Problem is, these basic cheats don't have any sort of LunaLua file to analyze. It's just another layer of the problem that's beyond access.