gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS homebrew announcements > Dual Hexen updated ! (a bit old)

#174103 - MrSkiz - Tue May 18, 2010 2:09 pm

Oh god ! I almost missed that : Dopefish released an update to Sektor's DualHexen back in december 2009 !
Quote:
This is a modified verison of Sektor's dualHexen, a port of Hexen to the Nintendo DS. Note that Sektor's version is itself a modification of Rich Whitehouse's hexenDS. Mainly I was frustrated by not being able to strafe, but there aren't enough buttons to go around, so I had to move something to the touchscreen. While I was at it I made a couple other changes, and here we are.

My changes include:

* Saving/Loading games (however savegames are not compatible with the PC version
* Inventory manipulation via the touchscreen:
o Touch the image of the active inventory item to use it.
o Touch the empty area just to the right of the item to bring up the inventory bar.
o Touch an item in the inventory bar to make it the active item.
o If you have more than 7 items in inventory, select the one at the edge to scroll, then return to your inventory.
o This interface could stand to be improved, but it is functional.
* Altered control configuration:
A = fire
B = use (i.e. open doors)
Y = jump
X = cycle weapons
L = strafe left
R = strafe right
D-Pad = move forward/backwards, turn left/right
Touchscreen = mouselook, inventory

Men you can't know how happy I am ! I've just quickly tested it and savegame seems to work, touchscreen is quite well implemented even if would prefer a control scheme more like DSHeretic's. I don't know if I could modify the source to achieve that...

move forward : up or x
move backward : down or b
strafe left : left or y
strafe right : right or a
jump : double tap on touchscreen
fire : right or left trigger

#174104 - MrSkiz - Tue May 18, 2010 4:05 pm

Ok I managed to find and modify the key bindings in m_misc.c in sources. Now I must find how to compile the code... Any tuts guys ?

#174107 - Cid2Mizard - Tue May 18, 2010 6:27 pm

Thanks :)
_________________
www.nintendomax.com 100% Hack 0% Warez

#174108 - MrSkiz - Tue May 18, 2010 7:31 pm

De rien Cid ! Je viens de retrouver mes infos de connexion sur nintendomax, je viendrais vous rendre visite plus ouvent ;)

I found it while scavenging the web looking for a method to convert ds.gba file into nds, precisely DSheretic which runs just fine on my M3real with GBA ram expansion pack but I would love to integrate it to DSkiosk, but it can't manage ds.gba

#174113 - thedopefish - Tue May 18, 2010 10:19 pm

Glad somebody else found my changes useful. Especially considering it was a one-off hack for my own personal benefit.

It should be pretty straightforward to change the key bindings in the way you want. m_misc.c holds the mapping between game actions and keyboard keys, while i_ibm.c maps the DS hardware buttons to keyboard keys, so between those two files you should be able to rebind things however you like.

The touchscreen inventory stuff is in g_game.c, and should be adaptable for creating other "buttons" on the touchscreen, but that will be a bit more involved than just shifting keys around. I'm not entirely sure how you'd add double-tap support, but I'm sure it's been discussed on these forums before if you're really interested in that feature.
_________________
#include <sig.h>

#174119 - MrSkiz - Wed May 19, 2010 7:46 am

Excellent !

Just few things : how do you compile the code ? Which tools must I use ? I've read Sektor's readme and some of the tools or libs he's talking about are linked but they're dead links for most.

(sorry, I'm totally noob in the compiling side)

#174120 - Sektor - Wed May 19, 2010 7:50 am

The sound code will need to be modified to work with latest libnds.
_________________
GTAMP.com/DS


Last edited by Sektor on Wed May 19, 2010 8:51 am; edited 1 time in total

#174121 - MrSkiz - Wed May 19, 2010 8:10 am

That's what I thought when I saw that the devkit arm used was an older version. So unless havin gthis version, I won't be able to compile...

#174122 - Sektor - Wed May 19, 2010 9:08 am

This code compiles with the current devkit: http://gtamp.com/DS/dualHexen_0.28_src.7z
_________________
GTAMP.com/DS


Last edited by Sektor on Sat Feb 05, 2011 9:10 pm; edited 7 times in total

#174123 - MrSkiz - Wed May 19, 2010 9:14 am

A thousand of thanx ! I'll learn with that...

#174125 - sverx - Wed May 19, 2010 10:45 am

It compiled but... is this supposed to run in an emulator? Both no$gba and DeSmuME only shows black screens...

edit: ouch, I've read now that it needs a WAD of a registered version of a shareware game...


Last edited by sverx on Wed May 19, 2010 10:49 am; edited 1 time in total

#174126 - MrSkiz - Wed May 19, 2010 10:47 am

You have the hexen.wad in data/hexen on your SD card, don't you ?

#174127 - sverx - Wed May 19, 2010 10:50 am

you were too fast :D

#174130 - MrSkiz - Wed May 19, 2010 2:59 pm

I managed to compile it... Now working on bindings.

In my first attempt I broke the touchscreen system, and half of my bindings failed... Silly me I should look better !

I see in i_ibm.c there's 2 sets of commands : 1 for the menus , the other for the ingame I guess. Is "If 0" for the menus ?

#174145 - MrSkiz - Thu May 20, 2010 2:09 pm

@Sektor,

Weird : I compiled your source without any modification but it appears that touchscreen freelook and some buttons don't work anymore.

I checked files of both yours and Dopefish source with winmerge and differences are very minor, mainly in i_sound.c but some seem to cut links with .h files, probably out to date in last devkit. Maybe they're useful to touchscreen management, the few I can understand seem to be related to led blinking, power and sound.

Or I missed something...

#174146 - Sektor - Thu May 20, 2010 2:14 pm

I can confirm touch stopped working, I just quickly made changes so it compiled. I didn't really test it. That should be much easier to fix than sound.
_________________
GTAMP.com/DS

#174147 - MrSkiz - Thu May 20, 2010 2:44 pm

OK if I understand well a long time ago touchscreen was controlled by ARM7 in homebrews but that's not the case anymore... Am I right ?

So there is probably a misuse of the new libnds' touchPosition functionality ?

#174148 - elhobbs - Thu May 20, 2010 3:02 pm

I think you may want to convert this to use the default arm7 code - libnds uses the fifo now so that could definitely cause some problems. It does not look like anything special is in the arm7 code for this project - just sound and touch which are both supported by the default arm7 code.

#174149 - MrSkiz - Thu May 20, 2010 3:20 pm

devkitPro\libnds\include\nds\arm9\input.h :
Code:
__attribute__ ((deprecated)) touchPosition touchReadXY() ;


/*!   \fn touchRead(touchPosition *data)
   \brief Obtains the current touchpad state.
   \param data a touchPosition ptr which will be filled by the function
*/
void touchRead(touchPosition *data);

Does this say the arm7 can't be used anymore for touchscreen management in the last libnds ? (may sound quite noobesque, and I am, but try to learn a little from this)

#174153 - Sektor - Thu May 20, 2010 5:56 pm

X, Y and touch are broken because of irqInitHandler in ds_main.c but just commenting that out will cause some crashing problems after the menu that I'm not sure how to fix. edit: Actually it stopped crashing now. I think my DS-X was just faulty.
_________________
GTAMP.com/DS


Last edited by Sektor on Sat May 22, 2010 7:24 pm; edited 4 times in total

#174154 - elhobbs - Thu May 20, 2010 6:27 pm

MrSkiz wrote:
devkitPro\libnds\include\nds\arm9\input.h :
Code:
__attribute__ ((deprecated)) touchPosition touchReadXY() ;


/*!   \fn touchRead(touchPosition *data)
   \brief Obtains the current touchpad state.
   \param data a touchPosition ptr which will be filled by the function
*/
void touchRead(touchPosition *data);

Does this say the arm7 can't be used anymore for touchscreen management in the last libnds ? (may sound quite noobesque, and I am, but try to learn a little from this)
no, it means that touchReadXY should no longer be used. use touchRead instead. this requires the use of default arm7 code - which sets up a fifo channel to handle the touch and X/Y buttons. they are not accessible from the arm9 directly. so the arm7 needs to send the values to the arm9.

#174169 - MrSkiz - Fri May 21, 2010 10:59 am

Sektor wrote:
X, Y and touch are broken because of irqInitHandler in ds_main.c

elhobbs wrote:
use touchRead instead. this requires the use of default arm7 code - which sets up a fifo channel to handle the touch and X/Y buttons.

Any link between both ?

Oh my I feel so stupid. I thought the XY of TouchreadXY were for touch coordinates...

#174171 - elhobbs - Fri May 21, 2010 1:37 pm

MrSkiz wrote:
Oh my I feel so stupid. I thought the XY of TouchreadXY were for touch coordinates...
it was for reading the x and y coordinates. the old version returns a struct and the new version fills in a passed in struct. I am guessing it was changed to be more efficient. the struct contains more than the x and y coordinates so maybe that has something to do with it as well...

#174177 - Sektor - Sat May 22, 2010 2:52 pm

On my DS-X flash card the game crashes if I comment out irqInitHandler() but it still works on M3CF.
_________________
GTAMP.com/DS


Last edited by Sektor on Mon Jul 19, 2010 4:27 pm; edited 3 times in total

#174181 - elhobbs - Sat May 22, 2010 5:51 pm

to get sound working
in ds_main.c - main
Code:
   lcdMainOnTop();

   // IRQ basic setup
   //irqInitHandler(on_irq);
   irqEnable(IRQ_VBLANK);
   
   //Sektor ledblink
   //irqInit();
   irqEnable(IRQ_VBLANK);
   soundEnable();
   //REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_SEND_CLEAR;
   //2010 NDSX_SetLedBlink_Off();
   //end ledblink
   
   //setup the main display
   videoSetMode(MODE_5_2D|DISPLAY_BG3_ACTIVE);


in I_sound.c - I_StartSound
Code:

#ifdef _HEXENDS
#define SOUND_DATA_OFFSET 8
   soundPlaySample((const void *)((u32)(data)+SOUND_DATA_OFFSET),
      SoundFormat_8Bit,
      len,
      11025,
      vol,
      63,
      0,
      0);
#else
   //no sound in win32, set dead immediately
    I_SetSfxTagDead(sfx);
#endif

#174183 - Sektor - Sat May 22, 2010 6:25 pm

Thanks for that.

There are minor crackles in the sound but it's better than no sound.
_________________
GTAMP.com/DS


Last edited by Sektor on Sat May 22, 2010 7:25 pm; edited 2 times in total

#174184 - elhobbs - Sat May 22, 2010 6:50 pm

the crackle is caused by SOUND_DATA_OFFSET - it is not needed. just pass data directly to soundPlaySample - do not add SOUND_DATA_OFFSET.
Code:
   soundPlaySample((const void *)data,
      SoundFormat_8Bit,
      len,
      11025,
      vol,
      63,
      0,
      0);

#174185 - Sektor - Sat May 22, 2010 7:06 pm

Cool.

Full source code with your sound code changes. I tried to go to warp to level 13 but it just froze. Warping to level 2 worked and the "greetings mortal" sound played fine. Warping to level 3 gave a malloc error.

Level warp works fine on Dopefish's version.
_________________
GTAMP.com/DS

#174187 - Sektor - Sat May 22, 2010 8:11 pm

MrSkiz wrote:
I see in i_ibm.c there's 2 sets of commands : 1 for the menus , the other for the ingame I guess. Is "If 0" for the menus ?

#if 0 isn't used, it's just a backup of my old key bindings.
_________________
GTAMP.com/DS

#174192 - elhobbs - Sun May 23, 2010 1:53 am

Sektor wrote:
Cool.

Full source code with your sound code changes. I tried to go to warp to level 13 but it just froze. Warping to level 2 worked and the "greetings mortal" sound played fine. Warping to level 3 gave a malloc error.

Level warp works fine on Dopefish's version.
I compiled the code without any of the modifications that I suggested and it still crashes. I am able to warp to level 13 sometimes but it dies frequently. particularly if I toggle the automap - though it is not required to get it to crash. I think that whatever the problem is it is just more likely to happen with the memory layout that the newer compiler generates. I did a diff of the sources and there are are only marginal differences - nothing obvious that would cause a problem.

#174195 - MrSkiz - Sun May 23, 2010 6:43 am

You two are my heroes of the moment, you know...

#174220 - MrSkiz - Mon May 24, 2010 2:41 pm

Oh my oh my : Actually you fixed the touchscreen freelook !

Two thumbs up for both of you !

So I managed to put my left-handed MPH-style control scheme and it works like a charm... Minus the lack of double-tap for jump, left trigger can do the job as Hexen isn't heavy on jumps but it woulf make it perfect. I must look into this - and touch areas for additionnal controls (flight) - now.

[HS] elhobbs : I know you want me to have a heart attack :] : I see movements on your code.google page ! Any cQuake update soon ?

#174226 - elhobbs - Mon May 24, 2010 5:43 pm

MrSkiz wrote:
[HS] elhobbs : I know you want me to have a heart attack :] : I see movements on your code.google page ! Any cQuake update soon ?
I have added in the ambient sounds as well as mp3 support for the cd music. It does not directly effect the framerate too badly but it requires a bit of memory. the lack of memory does effect the performance on some of the larger levels. I leave the latest build of the cquake.nds file in the svn. feel free to try it out - it is single player only though. the mp3 support currently requires 96kbs 22khz stereo encoded files at this point. stereo becuase I have not added mono support yet and 96kbs 22khz because the arm7 cannot decode much faster than that. it looks in the id1/music folder for files named 02.mp3 through 11.mp3 - the numbers represent the track numbers on the original CD. I was tempted to put together a zip file with the audio tracks but I am not sure if that is legit. the tracks were on the shareware cd so it makes me think it is ok - but I really do not know.

#174252 - elhobbs - Tue May 25, 2010 11:10 pm

I found the following in I_ZoneBase in i_ibm.c
Code:
   #ifndef _HEXENDS
      byte *thezone = (byte *)malloc(ZONE_SIZE);
   #else
      byte *thezone = (byte *)0x2200000;
   #endif

it is using a static address as the base for zone memory region. I am guessing this could cause lots of collisions with malloc.

#174330 - wolfmanz51 - Sun May 30, 2010 6:51 am

elhobbs wrote:
MrSkiz wrote:
[HS] elhobbs : I know you want me to have a heart attack :] : I see movements on your code.google page ! Any cQuake update soon ?
I have added in the ambient sounds as well as mp3 support for the cd music. It does not directly effect the framerate too badly but it requires a bit of memory. the lack of memory does effect the performance on some of the larger levels. I leave the latest build of the cquake.nds file in the svn. feel free to try it out - it is single player only though. the mp3 support currently requires 96kbs 22khz stereo encoded files at this point. stereo becuase I have not added mono support yet and 96kbs 22khz because the arm7 cannot decode much faster than that. it looks in the id1/music folder for files named 02.mp3 through 11.mp3 - the numbers represent the track numbers on the original CD. I was tempted to put together a zip file with the audio tracks but I am not sure if that is legit. the tracks were on the shareware cd so it makes me think it is ok - but I really do not know.

its legit its sharware

#174786 - MrSkiz - Mon Jul 19, 2010 4:19 pm

Finally, I came back to the last non-stylus version : too much instability of the program. I hope Dopefish or Sektor will find time and motivation to work on HexenDS.

The button-focused ergonomy isn't accurate but very enjoyable, more than stylus one if there's no double-tap for jump and extra commands on touchscreen.

#176428 - another world - Tue Jul 26, 2011 6:07 am

is the 4/4/11 binary based on dopefish's code or the recompile sources released on 5/23/10?

i'm curious because the 4/4/11 binary has save/loading and the touchscreen inventory that dopefish added.

i was also curious if the 4/4/11 binary has the music support elhobbs was working on and if so how does one get it working?

thanks!
-another world

#176429 - Sektor - Tue Jul 26, 2011 8:18 am

It doesn't have music support. I think it's based on Dopefish's version with some fixes by elhobbs. I'm not working on it.

http://gtamp.com/DS/dualhexen.php
_________________
GTAMP.com/DS