2009-10-23, 04:09 AM
This is going to have been an 8~10hr job before I get the joystick configuration in place (not including an in-game menu way)
Really it would've taken me no time at all to swap out the keyboard and joystick had I hard coded it in. Literally so far I've spent all of 5mins on that. It's all about processing the ini configuration file. I gotta admit I really set the bar high and the code is in my usual perfectionist vein. So maybe I have my self to blame. But anyway, the final product will really feel different compared to the crap you're accustomed to putting up with from SOM.
You'll be glad I've been able to hack circles around it... and the good news is by the time I'm done there will be few new challenges in the ini dept. So I can just focus on real features. I will distribute some stuff once the controller configuration is all there.
We will have to revive the what do you want out of SOM thread
[code=SOM_EX.INI]
;This is a Microsoft standard .ini extension file...
;C=en_US
;Anything else not within a section (the start of which is a
;single line surrounded by brackets, ie. []) Will be ignord.
;Everthing after the first section will be a section. You can
;make a [.Notes: Anything you wish here] section however. Or
;hide a section completely by putting a period before the name
;in brackets, ie. [.Player].
[Player]
;This section can assign different ini files per Windows user
;account (instead of this one)
[Remote]
;This section will fetch/merge additional configuration info
;from somewhere on the internet.
[Locale]
;This section is for manually overriding the environment locale
;settings (of your Microsoft Windows enivironment)
[Window]
;This section pertains to playing Sword of Moonlight inside a
;window (instead of fullscreen only play)
do_play_som_in_window = yes
[Stereo]
;Section pertaining to stereo projection ("3D goggles" vision)
[Action]
;The Action section assigns action names to keys (like a macro)
;Actions may also be assigned to a series or combination of keys.
;Changing these values may effect the effectiveness of the following
;sections, and or make controlling your game difficult or impossible
;The action names are up to you, but sould not be all caps because
;all caps symbols will be matched to internal symbolic constants.
;Action names must also be more than two letters so not to be
;confused with two character hexidecimal values.
?
Enter_menu = TAB
Shoot_magic = LCONTROL
Swing_weapon = LSHIFT
Dash_or_interact = SPACE
Reset_view = NUMPAD8
Look_up = NUMPAD9
Look_down = NUMPAD7
Walk_forawrd = NUMPAD5
Turn_left = NUMPAD1
Turn_right = NUMPAD3
Walk_backward = NUMPAD2
Step_left = NUMPAD4
Step_right = NUMPAD6
Select = RETURN
Cancel = ESCAPE
[Keymap]
;Each key (named variable) in this section represents a key
;on a keyboard and the corresponding value assigned is the
;key the player must press instead of the original key...
;Sword of Moonlight assigns the following keys to the
;following actions...
;In normal play
;TAB: Enter menu? ? ? ? ?? ;0f
;LCONTROL: Shoot magic? ?? ;1d
;LSHIFT: Swing weapon? ? ? ;2A
;SPACE: Dash/Interact? ? ? ;39
;END: Reset view? ? ? ? ?? ;cf
;PGDN: Look up? ? ? ? ? ?? ;d1 (also known as NEXT)
;DELETE: Look down? ? ? ?? ;d3
;UP: Wak forward? ? ? ? ?? ;c8
;LEFT: Turn left? ? ? ? ?? ;cb
;DOWN: Walk backward? ? ?? ;d0
;RIGHT: Turn right? ? ? ?? ;cb
;NUMPAD7: Look down
;NUMPAD8: Reset view
;NUMPAD9: Look up?
;NUMPAD4: Step left
;NUMPAD5: Walk forward
;NUMPAD6: Step right
;NUMPAD1: Turn left? ??
;NUMPAD2: Walk backward
;NUMPAD3: Turn right? ? ? ?
;Make walking/stepping via WASD
NUMPAD5 = 11
NUMPAD4 = 1e
NUMPAD2 = 1f
NUMPAD6 = 20
?
;In the menu of message dialog
;RETURN:? Select/Choice #1
;ESCAPE: Cancel/Choice #2
;Any hexidecimal number or DirectInput code can be used to
;name a key or value. For a complete reference please visit:
;https://www.gamespp.com/directx/directInputKeyboardScanCodes.html
;Or search the WWW for "DirectInput keyboard scan codes"
[Toggle]
;This section lets you toggle keys so they will remain pressed
;until the same toggle input condition is met (untoggling a
;key in a different way than it was toggled is not supported
;at present)
;This section works just like [Keymap], the keys are the original
;SOM keys and the assignments are the keys the player is to press
;in order to toggle the original key (which SOM will see)
;Currently toggling can only be in effect during normal play mode
;(that is not while inside a menu or text dialog context)
;A simple toggle can be SPACE = SPACE, ie. continue dashing once
;the SPACE key is pressed, until pressed again.?
[Keypad]
;Here extra keyboard keys may be chosen to simulate those
;designated in the [Keymap] section
[Joypad]
;This section can be used to spoof Sword of Moonlight's keyboard
;inputs, by simulating a keyboard via a Windows "Game Controller"
;you should set hide_controllers_from_som = yes so to avoid any
;conflicts with your Sword of Moonlight game.
;SOM will not detect any controllers
do_hide_controllers_from_som = yes
;A number or name with wildcards will do
joypad_to_use_for_play = 0??
;"Analog" stick/button/trigger functions:
;throttles look/move keys per frame
do_simulate_analog_signals = yes
?
;Pseudo-Buttons: you can create digital and analog buttons from your
;controller's feature set, such as joystick axes and pov hats. Even
;button combinations. This is necessary because only buttons can
;be used to simulate the keyboard.?
?
pseudo_x_axis = 13
pseudo_y_axis = 14
pseudo_z_axis = 15
pseudo_z_rotation = 16
pseudo_hat_north = 17
pseudo_hat_east = 18
pseudo_hat_south = 19
pseudo_hat_west = 20
?
;Buttons: each button is a number (see: Control Panel->Game Controllers)
;which is assigned to a key value (see: [Keymap] section) or series of
;keys called a macro. Assigned keys should correspond to the keymap!!
1 = Look_down
2 = Enter_menu
3 = Look_up
6 = Dash_or_interact
7 = Shoot_magic
8 = Swing_weapon
11 = Dash_or_interact
12 = Reset_view
;Negative/positive numbers have meaning for calibrated analog "buttons"
-13 = Step_left
+13 = Step_right
-14 = Walk_backward
+14 = Walk_forward
-15 = Turn_left
+15 = Turn_right
-16 = Look_down
+16 = Look_up
;Menu buttons are special. They end with an M
2M = Select
3M = Cancel
17M = UP
18M = RIGHT
19M = DOWN
20M = LEFT
;Text buttons end with a T
17T = Select
19T = Cancel
;The following keys can be used for on the fly modification of the
;existing joypad configuration
;flip_button_poles = ;list of analog buttons for which to flip polarity
;swap_button_pairs =? ;list of button pairs for which to swap assignments?
[Joypad2]
;Here you could define another joypad configuration...
[Joypad3]
;And another...
[Motion]
;This section lets you simulate keys with a mouse-type devices
[Memory]
;This section is for memory address macros which the following
;sections may depend upon. Changing these values can break your
;game which might constitute cheating
[Memmap]
;Changing this section is not advised for players and may
;break your game or very likely constitute cheating.?
[Editor]
;This section is for dynamically rewriting text on the fly before
;it is drawn to the screen for the player to see. Not to be confused
;with translation or menu customization.
[MenuRx]
;This section is for menu customization
[Dialog]
;Talking messages
wait_to_decide = 2000
wait_to_listen = 1000
do_waiting_icon = yes
[Mixing]
;Audio stuff
[Screen]
;Screen effects
[Static]
;Graphical fixtures
[Bugfix]
;bugs/glitches
[Output]
;Console output
[Module]
;Section for modules to be loaded...
;Sections for each module should be named after the loaded module
[System]
;This section should not be edited by anyone
[Config]
;This section (Config) should not be edited by hand!!
;It is reserved for saving the player's menu settings
[/code]
Really it would've taken me no time at all to swap out the keyboard and joystick had I hard coded it in. Literally so far I've spent all of 5mins on that. It's all about processing the ini configuration file. I gotta admit I really set the bar high and the code is in my usual perfectionist vein. So maybe I have my self to blame. But anyway, the final product will really feel different compared to the crap you're accustomed to putting up with from SOM.
You'll be glad I've been able to hack circles around it... and the good news is by the time I'm done there will be few new challenges in the ini dept. So I can just focus on real features. I will distribute some stuff once the controller configuration is all there.
We will have to revive the what do you want out of SOM thread
[code=SOM_EX.INI]
;This is a Microsoft standard .ini extension file...
;C=en_US
;Anything else not within a section (the start of which is a
;single line surrounded by brackets, ie. []) Will be ignord.
;Everthing after the first section will be a section. You can
;make a [.Notes: Anything you wish here] section however. Or
;hide a section completely by putting a period before the name
;in brackets, ie. [.Player].
[Player]
;This section can assign different ini files per Windows user
;account (instead of this one)
[Remote]
;This section will fetch/merge additional configuration info
;from somewhere on the internet.
[Locale]
;This section is for manually overriding the environment locale
;settings (of your Microsoft Windows enivironment)
[Window]
;This section pertains to playing Sword of Moonlight inside a
;window (instead of fullscreen only play)
do_play_som_in_window = yes
[Stereo]
;Section pertaining to stereo projection ("3D goggles" vision)
[Action]
;The Action section assigns action names to keys (like a macro)
;Actions may also be assigned to a series or combination of keys.
;Changing these values may effect the effectiveness of the following
;sections, and or make controlling your game difficult or impossible
;The action names are up to you, but sould not be all caps because
;all caps symbols will be matched to internal symbolic constants.
;Action names must also be more than two letters so not to be
;confused with two character hexidecimal values.
?
Enter_menu = TAB
Shoot_magic = LCONTROL
Swing_weapon = LSHIFT
Dash_or_interact = SPACE
Reset_view = NUMPAD8
Look_up = NUMPAD9
Look_down = NUMPAD7
Walk_forawrd = NUMPAD5
Turn_left = NUMPAD1
Turn_right = NUMPAD3
Walk_backward = NUMPAD2
Step_left = NUMPAD4
Step_right = NUMPAD6
Select = RETURN
Cancel = ESCAPE
[Keymap]
;Each key (named variable) in this section represents a key
;on a keyboard and the corresponding value assigned is the
;key the player must press instead of the original key...
;Sword of Moonlight assigns the following keys to the
;following actions...
;In normal play
;TAB: Enter menu? ? ? ? ?? ;0f
;LCONTROL: Shoot magic? ?? ;1d
;LSHIFT: Swing weapon? ? ? ;2A
;SPACE: Dash/Interact? ? ? ;39
;END: Reset view? ? ? ? ?? ;cf
;PGDN: Look up? ? ? ? ? ?? ;d1 (also known as NEXT)
;DELETE: Look down? ? ? ?? ;d3
;UP: Wak forward? ? ? ? ?? ;c8
;LEFT: Turn left? ? ? ? ?? ;cb
;DOWN: Walk backward? ? ?? ;d0
;RIGHT: Turn right? ? ? ?? ;cb
;NUMPAD7: Look down
;NUMPAD8: Reset view
;NUMPAD9: Look up?
;NUMPAD4: Step left
;NUMPAD5: Walk forward
;NUMPAD6: Step right
;NUMPAD1: Turn left? ??
;NUMPAD2: Walk backward
;NUMPAD3: Turn right? ? ? ?
;Make walking/stepping via WASD
NUMPAD5 = 11
NUMPAD4 = 1e
NUMPAD2 = 1f
NUMPAD6 = 20
?
;In the menu of message dialog
;RETURN:? Select/Choice #1
;ESCAPE: Cancel/Choice #2
;Any hexidecimal number or DirectInput code can be used to
;name a key or value. For a complete reference please visit:
;https://www.gamespp.com/directx/directInputKeyboardScanCodes.html
;Or search the WWW for "DirectInput keyboard scan codes"
[Toggle]
;This section lets you toggle keys so they will remain pressed
;until the same toggle input condition is met (untoggling a
;key in a different way than it was toggled is not supported
;at present)
;This section works just like [Keymap], the keys are the original
;SOM keys and the assignments are the keys the player is to press
;in order to toggle the original key (which SOM will see)
;Currently toggling can only be in effect during normal play mode
;(that is not while inside a menu or text dialog context)
;A simple toggle can be SPACE = SPACE, ie. continue dashing once
;the SPACE key is pressed, until pressed again.?
[Keypad]
;Here extra keyboard keys may be chosen to simulate those
;designated in the [Keymap] section
[Joypad]
;This section can be used to spoof Sword of Moonlight's keyboard
;inputs, by simulating a keyboard via a Windows "Game Controller"
;you should set hide_controllers_from_som = yes so to avoid any
;conflicts with your Sword of Moonlight game.
;SOM will not detect any controllers
do_hide_controllers_from_som = yes
;A number or name with wildcards will do
joypad_to_use_for_play = 0??
;"Analog" stick/button/trigger functions:
;throttles look/move keys per frame
do_simulate_analog_signals = yes
?
;Pseudo-Buttons: you can create digital and analog buttons from your
;controller's feature set, such as joystick axes and pov hats. Even
;button combinations. This is necessary because only buttons can
;be used to simulate the keyboard.?
?
pseudo_x_axis = 13
pseudo_y_axis = 14
pseudo_z_axis = 15
pseudo_z_rotation = 16
pseudo_hat_north = 17
pseudo_hat_east = 18
pseudo_hat_south = 19
pseudo_hat_west = 20
?
;Buttons: each button is a number (see: Control Panel->Game Controllers)
;which is assigned to a key value (see: [Keymap] section) or series of
;keys called a macro. Assigned keys should correspond to the keymap!!
1 = Look_down
2 = Enter_menu
3 = Look_up
6 = Dash_or_interact
7 = Shoot_magic
8 = Swing_weapon
11 = Dash_or_interact
12 = Reset_view
;Negative/positive numbers have meaning for calibrated analog "buttons"
-13 = Step_left
+13 = Step_right
-14 = Walk_backward
+14 = Walk_forward
-15 = Turn_left
+15 = Turn_right
-16 = Look_down
+16 = Look_up
;Menu buttons are special. They end with an M
2M = Select
3M = Cancel
17M = UP
18M = RIGHT
19M = DOWN
20M = LEFT
;Text buttons end with a T
17T = Select
19T = Cancel
;The following keys can be used for on the fly modification of the
;existing joypad configuration
;flip_button_poles = ;list of analog buttons for which to flip polarity
;swap_button_pairs =? ;list of button pairs for which to swap assignments?
[Joypad2]
;Here you could define another joypad configuration...
[Joypad3]
;And another...
[Motion]
;This section lets you simulate keys with a mouse-type devices
[Memory]
;This section is for memory address macros which the following
;sections may depend upon. Changing these values can break your
;game which might constitute cheating
[Memmap]
;Changing this section is not advised for players and may
;break your game or very likely constitute cheating.?
[Editor]
;This section is for dynamically rewriting text on the fly before
;it is drawn to the screen for the player to see. Not to be confused
;with translation or menu customization.
[MenuRx]
;This section is for menu customization
[Dialog]
;Talking messages
wait_to_decide = 2000
wait_to_listen = 1000
do_waiting_icon = yes
[Mixing]
;Audio stuff
[Screen]
;Screen effects
[Static]
;Graphical fixtures
[Bugfix]
;bugs/glitches
[Output]
;Console output
[Module]
;Section for modules to be loaded...
;Sections for each module should be named after the loaded module
[System]
;This section should not be edited by anyone
[Config]
;This section (Config) should not be edited by hand!!
;It is reserved for saving the player's menu settings
[/code]