Page 1 of 2

Ocarina

Posted: Mon Apr 18, 2011 3:09 am
by biolizard89
(First post here, hope this question isn't stupid)

Is work being done on adding Ocarina cheats/debugging to Swiss? If anyone's interested, I was able to get the new Gecko code handler to work for GC games. It wasn't thoroughly stress-tested, but cheats and debugging both appear to work in my tests. I can provide the source code (modified version of NeoGamma) if anyone wants to take a look at it. (I sent the source code to WiiPower a while back; I don't believe it's made its way into an official NeoGamma release yet.)

Let me know if you'd like to see the source; it'd be really nice to see Ocarina cheats/debugging working in Swiss.

Thanks,
-Biolizard89

Re: Ocarina

Posted: Mon Apr 18, 2011 3:12 am
by emu_kidid
happy to add it in - just give me code to port over.

I'd keep both engines in since the cheats parsing is already done for the current one.

Re: Ocarina

Posted: Mon Apr 18, 2011 3:21 am
by biolizard89
emu_kidid wrote:happy to add it in - just give me code to port over.

I'd keep both engines in since the cheats parsing is already done for the current one.
Impressively fast reply.

http://veclabs.fuzziqersoftware.com/fil ... andler.zip

This is the NeoGamma source code (with binaries included), modified to use the new Gecko code handler. There are two versions present; one has debugging enabled and has 255-ish lines of codes available, the other has debugging disabled and has 400-ish lines of codes available. Ideally someone would implement a menu to choose whether the debugging is enabled like is done for Wii games, but I didn't have time to do that.

The relevant files are mostly gameloader.c and loadapp.c for the GameCube component, and apploader.c for the Wii component. The code handlers are .bin files (source code also included).

Hope this helps!

Re: Ocarina

Posted: Mon Apr 18, 2011 3:31 am
by emu_kidid
nice, I'll give it a look over when I get some spare time.

edit: interesting url btw, the engine I use is from fuzziqersoftware himself a few years back :D

Re: Ocarina

Posted: Mon Apr 18, 2011 5:23 am
by liquitt

Re: Ocarina

Posted: Mon Apr 18, 2011 6:25 am
by biolizard89
@emu_kidid: Ah yes, I actually remember when Fuzziqer gave you the AR source... I was a beta tester and script author for Fuzziqer's GCARS-CS back in the Team-GX days. I'm actually working on a successor to GCARS-CS (Fuzziqer is not heavily involved) which uses the USB Gecko and works on GameCube or Wii games; it uses Ocarina for scripts similarly to the way GCARS-CS used an AR simulator for scripts, which is actually why I'm interested in Ocarina for Swiss.

@liquitt: Hey, good to see you, been a while. (I remember you from Team-GX, right? Or am I remembering you from somewhere else?)

Re: Ocarina

Posted: Mon Apr 18, 2011 6:42 am
by liquitt
good to see you too mate, been a hell of a while :D
Team-GX, well not directly, just lurking around and talking to most of you guys...i was involved in ngc-dev for a while, and GCOS beta testing...

btw, how realistic is it, that the GCARS-CS Server will ever see a release? ;)

Re: Ocarina

Posted: Mon Apr 18, 2011 6:50 pm
by biolizard89
liquitt wrote:good to see you too mate, been a hell of a while :D
Team-GX, well not directly, just lurking around and talking to most of you guys...i was involved in ngc-dev for a while, and GCOS beta testing...

btw, how realistic is it, that the GCARS-CS Server will ever see a release? ;)
Cool. From talking to Fuzziqer, my impression is that the GCARS-CS Server will probably not see a release. However, the new app I'm working on (GeckoTunnel) would quite possibly do what the GCARS-CS Server was supposed to do. May I ask what GCARS-CS Server features you were hoping for?

Re: Ocarina

Posted: Mon Apr 18, 2011 9:16 pm
by liquitt
biolizard89 wrote:
liquitt wrote:good to see you too mate, been a hell of a while :D
Team-GX, well not directly, just lurking around and talking to most of you guys...i was involved in ngc-dev for a while, and GCOS beta testing...

btw, how realistic is it, that the GCARS-CS Server will ever see a release? ;)
Cool. From talking to Fuzziqer, my impression is that the GCARS-CS Server will probably not see a release. However, the new app I'm working on (GeckoTunnel) would quite possibly do what the GCARS-CS Server was supposed to do. May I ask what GCARS-CS Server features you were hoping for?
well, online play of course :)

Re: Ocarina

Posted: Mon Apr 18, 2011 11:13 pm
by emu_kidid
Would be quite nice to see a successor to GCARS-CS :D

Re: Ocarina

Posted: Mon Apr 18, 2011 11:24 pm
by biolizard89
liquitt wrote:well, online play of course :)
Yep, online play will of course be in GeckoTunnel. :) I currently have recording/playback of gameplay as well as controller simulation working. So online play is just a matter of writing a UDP/IP interface for my existing code (hopefully not hard).

A few other features from the GCARS-CS Server are also planned for GeckoTunnel, e.g. region-free play and more than 4 players (I currently have 5-player Super Smash Bros. Melee partially implemented).

I'm not certain exactly when I'll have online play working, since I'm juggling about 6 major projects, plus I have school stuff that keeps me busy. But hopefully it won't take too long. :)

Re: Ocarina

Posted: Tue Apr 19, 2011 2:04 am
by kevstah2004
Can you use the cheat engine any debugger in tandem? ie: turn codes on/off without a joker from a menu whilst the debugger is active also can you monitor a address for value changes in real-time without having to do searches to bring to the address you wish to monitor? has anybody got any pics of this Ocarina cheat engine / debugger for the Wii in action? something like a tutirial page with all it's menus, i've yet to see it.

Re: Ocarina

Posted: Tue Apr 19, 2011 3:28 am
by biolizard89
kevstah2004 wrote:Can you use the cheat engine any debugger in tandem? ie: turn codes on/off without a joker from a menu whilst the debugger is active also can you monitor a address for value changes in real-time without having to do searches to bring to the address you wish to monitor? has anybody got any pics of this Ocarina cheat engine / debugger for the Wii in action? something like a tutirial page with all it's menus, i've yet to see it.
Yes, you can enable/disable codes from the PC side while the game is running, and you can monitor a particular address without searching for it.

There's a good (albeit outdated) video tutorial at http://wiird.l0nk.org/forum/index.php/topic,508.0.html , credit goes to Foxx.

Re: Ocarina

Posted: Tue Apr 19, 2011 4:37 am
by liquitt
biolizard89 wrote:
liquitt wrote:well, online play of course :)
Yep, online play will of course be in GeckoTunnel. :) I currently have recording/playback of gameplay as well as controller simulation working. So online play is just a matter of writing a UDP/IP interface for my existing code (hopefully not hard).

A few other features from the GCARS-CS Server are also planned for GeckoTunnel, e.g. region-free play and more than 4 players (I currently have 5-player Super Smash Bros. Melee partially implemented).

I'm not certain exactly when I'll have online play working, since I'm juggling about 6 major projects, plus I have school stuff that keeps me busy. But hopefully it won't take too long. :)
sounds good! if you need any help on the network stuff, let me know!

Re: Ocarina

Posted: Tue Apr 19, 2011 9:29 am
by biolizard89
liquitt wrote:
biolizard89 wrote:
liquitt wrote:well, online play of course :)
Yep, online play will of course be in GeckoTunnel. :) I currently have recording/playback of gameplay as well as controller simulation working. So online play is just a matter of writing a UDP/IP interface for my existing code (hopefully not hard).

A few other features from the GCARS-CS Server are also planned for GeckoTunnel, e.g. region-free play and more than 4 players (I currently have 5-player Super Smash Bros. Melee partially implemented).

I'm not certain exactly when I'll have online play working, since I'm juggling about 6 major projects, plus I have school stuff that keeps me busy. But hopefully it won't take too long. :)
sounds good! if you need any help on the network stuff, let me know!
Thanks man, I'll keep you updated. (Looks like progress will be somewhat slow until June due to quickly approaching final exams.)

Re: Ocarina

Posted: Tue Apr 19, 2011 1:26 pm
by kevstah2004
biolizard89 wrote:
kevstah2004 wrote:Can you use the cheat engine any debugger in tandem? ie: turn codes on/off without a joker from a menu whilst the debugger is active also can you monitor a address for value changes in real-time without having to do searches to bring to the address you wish to monitor? has anybody got any pics of this Ocarina cheat engine / debugger for the Wii in action? something like a tutirial page with all it's menus, i've yet to see it.
Yes, you can enable/disable codes from the PC side while the game is running, and you can monitor a particular address without searching for it.

There's a good (albeit outdated) video tutorial at http://wiird.l0nk.org/forum/index.php/topic,508.0.html , credit goes to Foxx.
I don't have any communication from my GC to PC, I was hoping it'd be included in a accessible interface on the GC side the same as GSPro, TempAR, CL-LiveDebug.

Re: Ocarina

Posted: Tue Apr 19, 2011 2:38 pm
by Hells Guardian
Do you have a USB Gecko? Thats the connection that is meant. They are quite easy to use a I do believe you can still buy them on the web. Though the already existing cheat parser would be more useful to those that don't own the USB Gecko It would also let us hook the game and dump the memory just before the crashes... That would give us further insight on how to fix the problem then just looking at a games dol and trying a minor change. with a ram dump at the time of the crash we can see exactly what went wrong. Not to mention that we can make our own codes for games loaded this way and manage our codes from a PC... The only disadvantage to the ocarina engine being added is that we will be unaqble to use a memory card, IDE-EXI, and the USBGecko at the same time.

Re: Ocarina

Posted: Tue Apr 19, 2011 3:12 pm
by biolizard89
Hells Guardian wrote:Do you have a USB Gecko? Thats the connection that is meant. They are quite easy to use a I do believe you can still buy them on the web. Though the already existing cheat parser would be more useful to those that don't own the USB Gecko It would also let us hook the game and dump the memory just before the crashes... That would give us further insight on how to fix the problem then just looking at a games dol and trying a minor change. with a ram dump at the time of the crash we can see exactly what went wrong. Not to mention that we can make our own codes for games loaded this way and manage our codes from a PC... The only disadvantage to the ocarina engine being added is that we will be unaqble to use a memory card, IDE-EXI, and the USBGecko at the same time.
Well, the Ocarina code engine only needs a USB Gecko for debugging; Ocarina does cheats without a USB Gecko. And Ocarina's code types are a lot more powerful than AR's (and AR codes can be automatically converted to Ocarina codes). So personally, I consider Ocarina better than the AR-based cheat hook even just for cheating. (There's nothing wrong with offering a choice, obviously.)

As for not having enough EXI slots, memcards are just used for unlocking stuff in 90% of games out there; if you have Ocarina, you can unlock everything there anyway. So I think that's not a huge issue. (We had to use cheats to unlock stuff in GCARS-CS games because the BBA had a habit of screwing up the memcard; it worked just fine.)

Re: Ocarina

Posted: Tue Apr 19, 2011 3:41 pm
by Hells Guardian
Oh I know that much I was simply elaborating on what kevstah was saying. Yes the ocarina engine can do codes without the USB Gecko but frankly there would be no need for it if that was all we were after. both the current cheat parser and ocarina work and adding codes manually to either one takes about the same amount of time.... The advantages of ocarina are the debugger engine and the ability to use a USB Gecko.

Re: Ocarina

Posted: Tue Apr 19, 2011 7:18 pm
by kevstah2004
Hells Guardian wrote:Do you have a USB Gecko? Thats the connection that is meant. They are quite easy to use a I do believe you can still buy them on the web. Though the already existing cheat parser would be more useful to those that don't own the USB Gecko It would also let us hook the game and dump the memory just before the crashes... That would give us further insight on how to fix the problem then just looking at a games dol and trying a minor change. with a ram dump at the time of the crash we can see exactly what went wrong. Not to mention that we can make our own codes for games loaded this way and manage our codes from a PC... The only disadvantage to the ocarina engine being added is that we will be unaqble to use a memory card, IDE-EXI, and the USBGecko at the same time.
No, I don't have a NA either. The MC issue could avoided by VMC support though.

Re: Ocarina

Posted: Tue Apr 19, 2011 8:17 pm
by Hells Guardian
Very true. it's a feature I really hope for.

Re: Ocarina

Posted: Tue May 17, 2011 6:12 pm
by WiiPower
Ok, i'll try to list everything that would be required to use Ocarina/Wiird with Swiss:

0: Clearing 0x80001800-0x80003000 before doing anything else Ocarina related won't harm
1a: The code handler needs to be in memory at 0x80001800
1b: The code handler needs to be configured

Code: Select all

	if (debuggerselect != 0)
	{
		// Boot with Wiird support
                memcpy((void*)0x80001800,GCcodehandlerDebug_bin,GCcodehandlerDebug_bin_size);
		
		// Paused start
		if (debuggerselect == 2) *(u32*)0x80002774 = 1;
		
		memcpy((void*)0x80001CDE, &codelist, 2);
		memcpy((void*)0x80001CE2, ((u8*) &codelist) + 2, 2);
		memcpy((void*)0x80001F5A, &codelist, 2);
		memcpy((void*)0x80001F5E, ((u8*) &codelist) + 2, 2);	
	} else
	{
                // Boot with Ocarina only
		memcpy((void*)0x80001800,GCcodehandleronly_bin,GCcodehandleronly_bin_size);
		memcpy((void*)0x80001906, &codelist, 2);
		memcpy((void*)0x8000190A, ((u8*) &codelist) + 2, 2);
	}
	
	memcpy((void *)0x80001800, (void*)0x80000000, 6);
By changing codelist, the memory location for the codes can be changed. And having the disc id at 0x80001800 is required.

For the binaries of the 2 code handlers and their source code, check NeoGamma's souce code


2: If any Ocarina codes are used, they need to be copied to the correct memory area. Without modification the code handlers and the Ocarina code area overlap, so it's recommend to copy the code handler 1st, then the codes. The default memory locations are:
if (gcdebuggerselect == 0)
codelist = (u8 *) 0x800022A8;
else
codelist = (u8 *) 0x800028B8;
The default code maximum is till 0x80003000.

Ocarina codes are .gct binary files which are to be created an external code manager. Usually their filename is 6 digits of the disc id.

3. The main.dol of the game needs to be hooked to call the code handler over and over. See patchcode.c and patchhook.S in NeoGamma's GC source code

Please warn the user if no hook was patched...

4. Instead of just jumping to the game's entry point, the game needs to be booted with this:

Code: Select all

			__asm__(
				"lis %r3, appentrypoint@h\n"
				"ori %r3, %r3, appentrypoint@l\n"
				"lwz %r3, 0(%r3)\n"
				"mtlr %r3\n"
				"lis %r3, 0x8000\n"
				"ori %r3, %r3, 0x18A8\n"
				"mtctr %r3\n"
				"bctr\n"
			);		
(only when Ocarina/debugger is actually enabled...)

So this should give a basic overview on how to do it, and i hope i didn't forget anything.

----------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------

Now to the problem:
Swiss uses the memory area 0x80001800 for the sd gecko/ide-exi reading code. So if Ocarina/Wiird support was added as it is, it would only work with retail discs. This could be fixed by moving Swiss code somewhere else, or by taking the code handler source and move that somewhere else. Maybe it's worth mentioning here that some Ocarina codes expect the code handler at 0x80001800, especially those which apply patches to the code handler.

Re: Ocarina

Posted: Tue May 17, 2011 11:27 pm
by emu_kidid
how big is the ocarina patch code? I could relocate my patch code to sit after it and just before 0x80003000 if possible.

Re: Ocarina

Posted: Wed May 18, 2011 12:28 am
by biolizard89
emu_kidid wrote:how big is the ocarina patch code? I could relocate my patch code to sit after it and just before 0x80003000 if possible.
Ocarina's patch code ends where the default code list start is:

if (gcdebuggerselect == 0)
codelist = (u8 *) 0x800022A8;
else
codelist = (u8 *) 0x800028B8;

Everything between there and 0x80003000 is the code list. You could use part of the codelist to store your patch code, and just give Ocarina a different codelist start/end, but that would limit the number of codes. What might be better is to use the GCARS memory allocation code that Fuzziqer gave you... it will reserve 32KiB at the top of memory; you could put either your patch code or the codelist there. Personally I would vote for moving the codelist to the top of memory using Fuzziqer's allocation, that way there's a massive 32KiB codelist available to Ocarina (assuming your patch code can fit between 0x800028B8 and 0x80003000).

Re: Ocarina

Posted: Wed May 18, 2011 2:13 am
by emu_kidid
something I've never fully understood about cheat code engines is this:

If I move Arena1Hi (top of memory heap) down 32kb, wouldn't that push memory locations in the game down, thus making cheats which rely on patching specific memory locations fail by making them actually write over other values?

Example:
Lets say that Player 1 health for game X is at 0x817F0000 and is 4 bytes long.. I have a cheat to keep it at 99% full at all times which would write to that location 99 over and over. If I bump Arena1Hi down 32kb so I can reserve it for my stuff, wouldn't Player 1 health now lie in another location in memory?
So wouldn't the cheat engine all of a sudden try to write to player 1 health (but now is really at 0x817E8000) at 0x817F0000?

Or have I totally mistaken how clever a cheat engine actually is?