Hi,
I don't tend to post here much, but I have been lurking for awhile. By the way, I'm not overly experienced in programming in C, or porting titles. I apologise if this forum is the wrong place to ask about this, as it is mostly about NetHack source code, but partly about Pandora controls and PND packaging. Is this even the right board?
Firstly: I've compiled and run NetHack 3.6.0 on my Pandora - this was quite simple. If anyone is terribly interested, I can post the steps needed to compile it, although it is quite straightforward. I've spent the last weekend delving into the source code, the (seemingly outdated) Pandora wiki (see here - it links to the gp32x forums*) and the forums here. It all works fine, but I'm really not a fan of using the yughjkbn (or vi) keys for movement - typing #kick 3 or 4 times in a row isn't much fun compared to the 'k' key - and we have these nice gaming controls; why not use them?
Second: I'm aware of the port of NetHack 3.4.3.1 available on the repo by lunixbochs (who has done a much better job than I can imho - I don't mean to devalue his work with this thread). This almost overcomes the issue - the D Pad works for making axis-aligned movements, and the diagonals can be done with the vi keys... Ideally I'd like to have at least two solutions for this - some suggestions: Use a shoulder button (e.g. right - ctrl isn't often used, so the 'Select' button should do) to 'rotate' the D Pad by 45 degrees clockwise - so Right Shoulder + Up = diagonal right + up. Or use the ABXY gaming buttons for diagonals, or maybe the nubs for all directions? ** The nubs will likely be the hardest to implement, but I'm willing to try! I personally have some gripes with this port too - the only clear ways to exit the game are through ctrl + c, or the extended command, #quit - both of which kill your character. You can press F11, then right-click the tray icon to close it, or even go through the trial of alt + F4... Typically, you just close the console window and your progress is saved. To me this seems essential, as an entire run can easily last 24 hours, and to new users of the ported version, this may pose a problem (see the repo comments as an example).
I've decided to post here in the hopes that someone might be able to give me some pointers (there is a distinct lack of decent documentation for the huge NetHack source code):
1. Where is the code that sets the direction buttons?
I managed to find an array that appeared to store all of the keyboard commands (not sure where though), including the vi keys, but only as letters (no key codes) - so I'm unsure how to set these as the gaming controls - what are the characters/strings associated with them (e.g. page up)? (I assume NetHack makes this difficult in particular, as it uses essentially every key, so there can't be cheating like swapping the vi keys for WASD) And where do the numpad keys come into play anyway? The functions "do_move()" and "getdir()" turn up a lot, and I can find where they are defined, but can't seem to find where the keys are bound. lunixbochs managed to solve the movement problem somehow though. I may be being totally dumb and missing something obvious - I'm here to learn!
2. What are the keycodes for all of the gaming buttons (the wiki mentions conflicting codes)? And how can I make them play nice with the NetHack code?
3. Are there any better suggestions for controls, including diagonals?
4. Are there any other QoL improvements that can be thought of?
5. Would anyone be interested in this going onto the repo? And would leaving it as a standard console application (no fancy fullscreen mode) be acceptable? This at least allows you to close the window, and you can still use F11 to toggle it.
I am happy to code the movement controls in, provided these questions are answered, but I can't make any promises on quality or time scales. I don't want to be a nuisance and ask someone else to do this for me (I think this is achievable and will be a good learning experience), but all of this is moot if someone here/lunixbochs is working on it already.
Thank you for taking the time to read this, and I appreciate any help I can get!
Edit: Compiled (hacky) build here
* Note: most of the threads I've since found on here, and didn't find anything really helpful for this problem in particular...
** Some input here would be nice... Some of you must play NetHack, right? I can (probably) include all of the options, and allow the user to change them through the in-game options - so not worth a poll imo.
I don't tend to post here much, but I have been lurking for awhile. By the way, I'm not overly experienced in programming in C, or porting titles. I apologise if this forum is the wrong place to ask about this, as it is mostly about NetHack source code, but partly about Pandora controls and PND packaging. Is this even the right board?
Firstly: I've compiled and run NetHack 3.6.0 on my Pandora - this was quite simple. If anyone is terribly interested, I can post the steps needed to compile it, although it is quite straightforward. I've spent the last weekend delving into the source code, the (seemingly outdated) Pandora wiki (see here - it links to the gp32x forums*) and the forums here. It all works fine, but I'm really not a fan of using the yughjkbn (or vi) keys for movement - typing #kick 3 or 4 times in a row isn't much fun compared to the 'k' key - and we have these nice gaming controls; why not use them?
Second: I'm aware of the port of NetHack 3.4.3.1 available on the repo by lunixbochs (who has done a much better job than I can imho - I don't mean to devalue his work with this thread). This almost overcomes the issue - the D Pad works for making axis-aligned movements, and the diagonals can be done with the vi keys... Ideally I'd like to have at least two solutions for this - some suggestions: Use a shoulder button (e.g. right - ctrl isn't often used, so the 'Select' button should do) to 'rotate' the D Pad by 45 degrees clockwise - so Right Shoulder + Up = diagonal right + up. Or use the ABXY gaming buttons for diagonals, or maybe the nubs for all directions? ** The nubs will likely be the hardest to implement, but I'm willing to try! I personally have some gripes with this port too - the only clear ways to exit the game are through ctrl + c, or the extended command, #quit - both of which kill your character. You can press F11, then right-click the tray icon to close it, or even go through the trial of alt + F4... Typically, you just close the console window and your progress is saved. To me this seems essential, as an entire run can easily last 24 hours, and to new users of the ported version, this may pose a problem (see the repo comments as an example).
I've decided to post here in the hopes that someone might be able to give me some pointers (there is a distinct lack of decent documentation for the huge NetHack source code):
1. Where is the code that sets the direction buttons?
I managed to find an array that appeared to store all of the keyboard commands (not sure where though), including the vi keys, but only as letters (no key codes) - so I'm unsure how to set these as the gaming controls - what are the characters/strings associated with them (e.g. page up)? (I assume NetHack makes this difficult in particular, as it uses essentially every key, so there can't be cheating like swapping the vi keys for WASD) And where do the numpad keys come into play anyway? The functions "do_move()" and "getdir()" turn up a lot, and I can find where they are defined, but can't seem to find where the keys are bound. lunixbochs managed to solve the movement problem somehow though. I may be being totally dumb and missing something obvious - I'm here to learn!
2. What are the keycodes for all of the gaming buttons (the wiki mentions conflicting codes)? And how can I make them play nice with the NetHack code?
3. Are there any better suggestions for controls, including diagonals?
4. Are there any other QoL improvements that can be thought of?
5. Would anyone be interested in this going onto the repo? And would leaving it as a standard console application (no fancy fullscreen mode) be acceptable? This at least allows you to close the window, and you can still use F11 to toggle it.
I am happy to code the movement controls in, provided these questions are answered, but I can't make any promises on quality or time scales. I don't want to be a nuisance and ask someone else to do this for me (I think this is achievable and will be a good learning experience), but all of this is moot if someone here/lunixbochs is working on it already.
Thank you for taking the time to read this, and I appreciate any help I can get!
Edit: Compiled (hacky) build here
* Note: most of the threads I've since found on here, and didn't find anything really helpful for this problem in particular...
** Some input here would be nice... Some of you must play NetHack, right? I can (probably) include all of the options, and allow the user to change them through the in-game options - so not worth a poll imo.
Last edited: