Need help with port of AlephOne game engine

Discussion in 'Wii - Emulation and Homebrew' started by mathieudel, Sep 24, 2012.

Sep 24, 2012
  1. mathieudel
    OP

    Newcomer mathieudel Newbie

    Joined:
    Sep 24, 2012
    Messages:
    7
    Country:
    France
    Hi all !

    First of all, let me introduce you to the AlephOne game engine : it's an open source game engine used to play Bungie's Marathon game and its add-ons. Think of Marathon as of Halo back in Doom's day.

    Being a Marathon freak, I started to port the AlephOne game engine to the Wii a year ago, but I stopped 9 months ago due to a crash that I am not able fix. Now I would really try to go further and finish this port, that's why I call for help here. Here is project's web site : https://code.google.com/p/aleph-wone/

    The engine is SDL based so I started the port using Wii-SDL. That worked and the game can be somewhat played but several bugs remained that I associated with Wii-SDL. Not that happy with this port of a very old version of SDL, I decided to use SDL's latest version as a new starting point and added tueidj's SDL code to it (or at least the one he uses in CorsixTH). The idea behind this was to first port SDL to the Wii in a way that that could be integrated in main-stream SDL.

    All goes well and I eventually managed to get SDL to compile properly for the Wii using auto-tools (yeah I now, some of you may stop reading from now). The game even run mostly (see later) as expected in Dolphin emulator... but, when I try to run it on a real Wii, it crashes at initialization time.
    I spent countless hours trying to understand what was going wrong and all I can say is : SDL seems to pass all initialization code, but it crashes when trying to load the first sound it has to play.

    Interestingly enough, Dolphin sends me this message (that I only vaguely understand) when starting game's emulation (way before SDL is even called) :
    DSPHLE: Unknown ucode (CRC = 078066ab) - forcing AXWii.
    Try LLE emulator if this is homebrew.


    Now before going any further into explanations, would anybody here be kind enough to help me resolve this issue ? I can, of course provide full crash logs and a lot more details about all this (at least, once I'm at home).
    Anybody willing to try can :
    1. Download source code from here, in the wiimote_control branch : https://code.google....one/source/list
    2. Build, going to the scripts folder and type ./build-aleph-wone.sh using a reasonably clean devkitpro r26 with all portlibs installed. Build scripts are very unix-centric and works flawlessly on MacOS 10.6 (you'll need to install zzip first). They should work properly on recent Ubuntu distros too but the last commit is more of hack to let it build on Mac so your mileage may vary.
    3. Install built binary, doing one of :
      • Follow steps given here : https://code.google....ki/Installation
      • Add Marathon 2 game files downloaded from AlephOne web-site to a resources/m2/AlephOne folder and type ./deploy from the scripts folder. That will create a dist folder with everything set-up to be copied on a SD-Card
    If you're interested, build scripts all have documented options, feel free to explore.


    You can see the game working on the Wii by using the version marked as deprecated in project's download section (refer to the aforementioned install process) : https://code.google..../downloads/list

    To see my first help request, go here ;) : https://code.google....pNeeded__Really
    Once the crash is fixed, I intend to fix the 4 remaining bugs, and improve playability by better wiring the wiimote to the game (that was current branch's fist purpose).

    Pfhew !! That was my first post here :) !
     
  2. newo

    Newcomer newo Advanced Member

    Joined:
    Apr 7, 2011
    Messages:
    99
    Country:
    Jamaica
    you may have better luck getting help finding the bug on the wiibrew.org forums.
     
  3. mathieudel
    OP

    Newcomer mathieudel Newbie

    Joined:
    Sep 24, 2012
    Messages:
    7
    Country:
    France
    Thanks for the advice, I'll go there instead.
     
  4. DRS

    Newcomer DRS Member

    Joined:
    Mar 31, 2012
    Messages:
    24
    Country:
    Netherlands
    I'm not into SDL but I've seen issues with the order in which filesystem is mounted and lwp threads are started if I remember correctly. Made it crash very early. Besides that I have seen it crash on a simple printf too. When using too much SRAM, you won't get any response either. Dolphin seems to be a bit more tolerant. But I prefer the real HW anyway, its a lot faster than a 2.5GHz I7 emulating it.

    Initialize video, stack and fs first, then create threads works for me. I don't use printf either. If no one else knows/can help, you could implement remote logging or try to debug. In the worst case, you have to strip down your code to the main function, and then build it up again, running it frequently to see where the error occurs.

    Good luck
     
  5. mathieudel
    OP

    Newcomer mathieudel Newbie

    Joined:
    Sep 24, 2012
    Messages:
    7
    Country:
    France
    Thanks a lot for the advice.

    I don't know for sure since I can't look at the source code right now, but I think the engine is initializing the file system then the video and afterward the audio which in turn starts a thread, so it seems fit what works for you. Anyway the game does not crash that early : file system is mounted, game file have been partially loaded video backend is working, even displaying the mouse for one frame etc...

    As for the debug, I thought about remote logging at the very start of my project but it never worked : socket opened on both the Wii and the PC, soon followed by a timeout PC-side, closing the connection, and no packets were sent. I finally postponed this feature. Time for revival ? :)

    Currently I am using Dolphin debugger... quite a tedious task since it only displays disassembled code. Anyway I managed to narrow down the problem : the sound thread successfully perform its first loop but then SDL's audio device struct is filled with zero (still dunno why) and the second iteration crashes trying to call a callback that is now NULL :( ! Ah yes, the game crashes the emulator too now that I use LLE DSP emulator.

    As a side note, I disabled audio for now just to see if the game if working and that's the case... except that the mouse is not refreshed as expected ! I may well revert back to tantric's SDL code, or do some merge between the two.
     
  6. DRS

    Newcomer DRS Member

    Joined:
    Mar 31, 2012
    Messages:
    24
    Country:
    Netherlands
    Cool, glad you found the issue! If reverting doesn't work you could create a small project just to get the sound working. Look at some working homebrew sound code and see if you can 'steal' it to power your SDL implementation.

    Hahaha, yeah, debugging PPC code isn't fun. But it does show the symbol names at least:)
     
  7. mathieudel
    OP

    Newcomer mathieudel Newbie

    Joined:
    Sep 24, 2012
    Messages:
    7
    Country:
    France
    Well, sound code already is tueidj's one, the one that he uses in CorsixTH, and I also tried with what he used with EDuke32 with no success.

    So I'm here trying to find a bug that crashes 100% in a game engine that works flawlessly on most desktop OSes going from MacOS 9 to WIndows 7, including Linux distros and even BeOS (should be enough to say it's stable), using an SDL implementation written by some of the best Wii homebrew authors and perfectly working in many game ports...

    Ho ! did I mentionned the mouse cursor is not refreshed properly (only visible one frame every many others if moving quite fast, but not too much :P) !

    I think I'm feeling bad...
     

Share This Page