fuzziqersoftware / newserv

Phantasy Star Online game server, proxy, and reverse-engineering tools
MIT License
166 stars 37 forks source link

[BLUE BURST] Feature Request: Modify default controller button mappings #548

Closed PalasX closed 2 months ago

PalasX commented 2 months ago

Is your feature request related to a problem? Please describe. Request not related to a problem.

Describe the solution you'd like Public Tethealla server used e7base.bin to set many defaults for new characters, including the default button mapping for controllers. Binary modifications could be made to edit the default button configuration for new characters. I used this feature to set default mappings that worked for wired XBox 360 controllers, as most of the people that logged in used those controllers. Button mapping data started at offset 312E in the bin file.

Is there any functional way to do the same for Newserv? I tried to look, but couldnt find where a new character is built in the source, so i was unable to see how it's currently done.

Im attaching the default e7base.bin and one modified with different controller mappings for reference. I had the relevant section of the bin file documented, but that was lost when the ephinia forums nuked the relevant subforum, sadly.

Game version(s) (choose one or more of the following): BB

Additional context e7base.zip

Add any other context or screenshots about the feature request here.

fuzziqersoftware commented 2 months ago

Character and system files are constructed in SaveFileFormats.cc; see e.g. DEFAULT_KEY_CONFIG. But I've made a change just now so the server will use the file system/blueburst/default-keyboard-config.bin if it exists, so you shouldn't have to modify any code anymore to change the default keyboard config. The data in that file maps to the data starting at offset 2FC0 in e7base.bin. There is also system/blueburst/default-joystick-config.bin, which maps to the data starting at offset 312C in e7base.bin. It sounds like this is the file you'd want to change.

PalasX commented 2 months ago

Thank you!!! That is utterly amazing! So much way better of an implementation that i was cooking up. Thank you! I'll be rebuilding this weekend and get it setup for a long questing session.

Is this documented anywhere besides this issue? I can put some time in and write something up this weekend if i can find my old notes on what the binary data maps to, controller wise, if it'd help.

::EDIT:: default-joystick-config.zip

attaching my file for xbox 360 controller, setup as close to original gamecube controller as possible. it seems ive lost my original notes as to what each byte does, for each controller option :( anyone still have that documentation?

image

Adding this infographic i slapped together to better describe the attached default-joystick-config.bin that i previously attached

fuzziqersoftware commented 2 months ago

newserv just treats keyboard and joystick configs as opaque binary data since the server doesn't need to edit them for any reason. That said, if you have notes on these structures, I'd be happy to add them to newserv's documentation in the code.

PalasX commented 2 months ago

Tethealla did the same. I think what i did originally was:

setup the controller the way it made sense for the xbox 360 controller
save the character to the server and exit the server
pull the binary blob for the character from the sql server storing it.
check the source code for where in that blob the controller config was
copy that controller config binary over the relevant section in teth's e7base bin file.

looking at the binary data, it LOOKS like a sequntial set of inputs, likely in the same order as on the in-game options menu, that is just a bitmask'd list of controller inputs/buttons/axis/etc that controlls each function.

effectively i used the in-game menu to create the new default config i wanted everyone to get, and then overwrite was used to be there. not elegant, but works. for anyone else thats wants to do the same with NewServ, you can setup your preferred controller config, and then open your .psochar file in a hex editor. the offset 0x312C, with length 0x38, is your controller config. you can copy that into a new default-joystick-config.bin and all new chars will have that config.