Views: 10,851,350 Home | Forums | Uploader | Wiki | Object databases | IRC
Rules/FAQ | Memberlist | Calendar | Stats | Online users | Last posts | Search
05-30-20 08:54 AM

Main - Posts by Treeki

(post deleted) #27413

Posted on 07-07-13 11:28 AM, in The Introductions Thread Link | #27416
Hi, I'm a rereg of GreggGlem. I wake up every day and download Newer to my PS2 and make some levels. Every single day. Then I go to RVLution to write lots of posts describing my daily routine and reply to comments made by my other reregs.

No, but seriously, I'm Treeki.

You may know me as the original creator of the NSMB DS editor and the lead programmer of Reggie and Newer SMBW. I'm also an admin on one of the internet's worst game modding boards. Hopefully the "worst" part will change soon.

I'm here to infiltrate the ranks of K64 and SMG2.5 and slowly take over everything maybe contribute some things to low-level programming and ASM hacking for SMG, because I've spent a ton of time and effort working on tools to allow this for NSMBW and I'd like to see it be doable for other Wii games.

I'll probably be more active in IRC than on the board, but I figured I'd sign up anyway because MM says I cannot win anything in next year's Mosts without an account. And that is the best reason to sign up, right?!

Posted on 07-07-13 08:39 PM, in Tools recomended for doing 'this' Link | #27469
Without IDA, you won't have much luck :< You can disassemble GC/Wii code with devkitPPC's objdump and some understanding of the .dol format... but working with a text disassembly is a monstrous pain. Trust me.

Anyhow, as to what you ask.. I suppose you could do some magic to disassemble the .dol to a gigantic ASM file and then reassemble it. Not sure how well this would work though. The method I took for Newer was to patch the game after it's been loaded, which is the only thing you can do if you want to support Riivolution (which doesn't allow you to replace the .dol).

You cannot automatically decompile C++ code. I guess you could do it by hand if you have a few years to spare :p There's some tools that can decompile code to an extent, like the Hex-Rays Decompiler (written by the IDA developers), but afaik none support PPC. And you won't get code that's good enough to feed straight into a C++ compiler; these tools are made with the purpose of analysing and understanding code, not for creating something that you can modify and recompile.

Have I dashed your hopes enough yet? :p

Also, while working on Newer, I realised very early on that writing assembly code directly is... not fun. Seriously. What I ended up doing was writing more complex things like new enemies/sprites in C++ and dropping down to assembly when I needed to make small changes or when writing ASM would be faster than putting together C++ headers (class/struct definitions, etc) for whatever I needed.

Posted on 07-07-13 11:12 PM, in Tools recomended for doing 'this' Link | #27475
The original game is written in C++, so writing compatible code is possible. With practice, you learn to identify patterns, and you can put together compatible versions of structs, classes, function signatures, ... which you can add to header files so your code can interoperate with the game.

The other big hurdle you'll encounter is that CodeWarrior on PPC (the compiler Nintendo uses) doesn't use the Itanium C++ ABI, which is the standard that most other compilers - including GCC - use. This means that a bunch of C++ features are implemented differently behind the scenes (destructors and virtual functions are the two big ones that come to mind right now) and if you compile code with GCC that uses these, it won't be binary compatible with stuff compiled with CodeWarrior. Which includes mostly everything cool you could do for NSMBW and SMG, including custom objects, etc. Great, right?!

I solved this for Newer by modifying the Clang compiler. I'll be releasing this along with my other tools for injecting code/patches later this year, but I need to do a decent amount of cleaning up and refactoring before I'm comfortable putting them out there.

Here's an example from the NSMBW headers if you're curious about what this kind of thing looks like: http://pastie.org/private/u596vxc9ki5cbtaikzva - These are the base classes for processes, actors and scenes, and I put these together entirely through reverse-engineering the data layouts and method signatures (that's why some fields and method arguments have placeholder names).

I was under the impression that it required modifying and re distributing this Main.dol file. So if that's not the case, then memory patches? In the context of the Wii and 'Riivolution', I'm not entirely sure what that means. Do these memory patches work in a way similar to Gecko codes?
Yep, except that Gecko codes are reapplied every frame- Riiv's memory patches are applied at the very beginning of the game, after the .dol has been loaded into RAM, but before any code from it has been executed.

For Newer, the path I took was to have a tiny bit of "bootstrap" code which detects the running game version and loads the correct version of the patches + code. This code is loaded using memory patches on Riivolution and injected into a modified .dol when loading the game through an ISO. This has a few benefits:

- No need to prepare separate copies of the patches/code for ISOs and Riivolution
- No need to worry about different game versions
- Patches can be easily updated just by popping a few files into a folder
- Patches can be loaded after the game is booted, which is necessary for NSMBW (because over half of its code is in .rel files which are all loaded during the Wrist Strap warning screen)

How exactly did debugging something like that go?
Tons and tons of OSReports. (The Wii SDK's version of printf.) Coding for Newer has got me so used to debugging that way that I rarely bother with actual debuggers when I'm working on regular PC stuff now :|

Posted on 07-08-13 03:22 PM, in Tools recomended for doing 'this' Link | #27519
Posted by Bluma
In the meantime then, what do you recommend I use until these tools are complete?
You have two choices, and both are pretty awful... you can use the CodeWarrior compiler (a version has been leaked before, from the GC SDK) to compile your code, or you can use GCC if you avoid the features I mentioned.

The latter is doable, it just makes writing code more difficult and error-prone because you have to put together your own vtables, write constructors/destructors and make sure you call all the appropriate functions, etc.

Posted by Bluma
This is also very interesting. I guess I didn't realize that you had to write separate patches for different versions and regions.

So you wrote a program that detects the game version? Is Riivolution capable of executing code like that before booting the game?
Kind of. There's a section in RAM which is unused by games; 6kb at 0x80001800 - this is where the stuff for applying Ocarina/Gecko codes goes, btw - which you can use to place some code. Load it in using a memory patch, and modify some of the game's bootup code so it will call whatever you place there.

These are the relevant patches in the Newer Riivolution XML: http://pastie.org/private/vbriuoge14rmm3os5x0g
And this is the source code for said loader: http://pastie.org/private/lcn1ueryxjtgmo61ho3xa

Writing the same patches for different game versions is incredibly tedious and there are minimal changes between the different NSMBW versions, so I compared RAM dumps from each version to find out exactly where code and data was added/removed. I then wrote a small bit of code that used this info to automatically convert addresses between different versions, and used it to automatically compile 6 different versions of the patches.

Posted by Bluma
How did you get a hold of a development kit? I was only able to locate one for Wii Opera applications.
A couple of versions of RVL_SDK have been leaked, but you don't need them for this.

There are various Wii games and apps where the developers have inadvertently included .sel or .map files which include names for every function linked into that game's binary. (One developer left in an unstripped .elf. Oops.) You can use these to find out the names of most of the SDK functions, and with some - admittedly, tedious - work you can locate them in whichever game you're modding. You can then call them from your own code!

Posted on 07-08-13 08:04 PM, in Mega-Mario (#1) Link | #27547
Yep. And what happened to good old ABXD? Now it's "Blargboard", whatever that is.


Blarg is negative. Blarg is bad. That can't be good... right? How can you name some software after a negative thing?


Blargboard's true colours are starting to show.


.... It's true. Blargboard is evil.

And so is Mega-Mario.


Yep. Definitely permaban.

Posted on 11-28-13 06:46 PM, in Bitcoin, Currency, and Economics Thread Link | #35461
I used to have something like 0.67 bitcoins that I got for free from a few people back in 2010 when they were barely worth anything...

I spent most of them last year and early this year (mostly on games) when the value was around $100. I'm regretting that, I could have had $700 worth now :( I've only got around 0.07 BTC left now. I'm keeping that for now just in case the value goes up even further...

Main - Posts by Treeki

Page rendered in 0.029 seconds. (2048KB of memory used)
MySQL - queries: 22, rows: 114/114, time: 0.024 seconds.
[powered by Acmlm] Acmlmboard 2.064 (2018-07-20)
© 2005-2008 Acmlm, Xkeeper, blackhole89 et al.