Hacking Devolution Speculation thread

  • Thread starter Thread starter lovewiibrew
  • Start date Start date
  • Views Views 140,532
  • Replies Replies 745
Status
Not open for further replies.
Off-topic: The name "Devo" comes "from their concept of 'de-evolution' - the idea that instead of continuing to evolve, mankind has actually begun to regress, as evidenced by the dysfunction and herd mentality of American society."

On-topic: Just let the guy work and the questions will be answered when it's released.
 
  • Like
Reactions: 2 people
Here's a mild tech write-up of what I spent yesterday doing, to at least show that progress is being made.

There had been a few reports of the memory card emulation failing, normally involving the game giving some sort of error while saving and then stating that the device in slot A isn't a memory card. The second part is easy to explain: once a game decides the memory card is bad, it won't change its mind until it sees a new card inserted and that behaviour isn't part of the emulation (there's no point). But what was causing the original error?
The only thing that stood out from the logs is that the memcard.bin file (the 16MB file that stores the memory card content) was always fragmented. Fragmentation normally isn't much of a big deal, on average it only requires one extra read of the FAT area when you want to seek backwards in a file. Real memory cards are solid state devices meant to work pretty fast; the gamecube SDK actually sets up a 100ms timeout callback whenever it writes something to a card. If the timeout period expires before the write finishes, the game decides the card is bad and won't do anything more with it. 100ms is a fairly long time just for a single write, but there might also be other reads occuring simultaneously if the game is also reading from the DVD or using audio streaming. In these cases things get even worse when the ISO is fragmented because the FAT accesses will probably be to a different area.
The maximum size of an individual memory card write operation is 128 bytes. Since this is smaller than a single sector the target sector must first be read, then the new data is placed (overwritten) within it, then it gets written back to the disk. On top of all this there's the SCSI/USB overhead, which breaks each read/write into three seperate USB commands. Each USB command is an IPC command which requires costly cache flushing/invalidation and is accomplished via four separate operations between the PowerPC and IOS/Starlet (request->request ack->response->response ack).
Additionally, every time the game reads or writes to one of the EXI registers (which is how it tells the memory card what to do) the amount of time taken is hundreds of times longer than it would be on a real gamecube since it's being emulated. Unfortunately the timer is started before the writing process begins, so there's a fair bit of "emulation time" that also gets included.

Possible ways to fix:
- Cache the entire memory card contents in memory: there's enough room to do it, but it's a large waste since a particular game will only use a small portion of the card. Plus it would mean delayed flushing of the memory card contents to disc and that could mean data loss.
- Wind back the timebase values while a write is in progress: not a great idea since that timebase also drives lots of other things, particularly audio/video playback.
- Asynchronous writing: tell the game that each write command finishes immediately and then do the real write operation in the background. Again, not a great idea because the game might disable interrupts and they are needed to talk to starlet. There's also the problem of what to do if the game immediately attempts another write operation - if it is delayed until the real write is finished, we're back to where we started.
- Patch the timeout value: Simple and obvious. The only risk is making sure the opcodes that need patching are distinct enough to always be detected and avoid false positives. I compared a launch game (Rogue Leader) against the latest game I have (Geist) and the timeout setup was identical, so the patch went in to change the timeout period from 100ms to 1 second (which should be more than enough).
 
  • Like
Reactions: 8 people
Will the system report to the user when the timeout patch sequence can't be found?
If it's the case, it will be tested automatically during use.
Maybe it will create a logfile with the abnormalities during startup?

It's good to hear you are making progress, specially with all the comotion going on about other gc related projects...
 
With on-the-fly patching there's no way to know if a piece of code doesn't exist or it just hasn't been encountered yet.
 
Ok. I get it. I thought the patching was done at startup when the game program was loaded into memory.
 
Would it be possible to emulate saves on a solid state device, such as an SD card, while still loading the actually game from USB?
 
- Patch the timeout value: Simple and obvious. The only risk is making sure the opcodes that need patching are distinct enough to always be detected and avoid false positives. I compared a launch game (Rogue Leader) against the latest game I have (Geist) and the timeout setup was identical, so the patch went in to change the timeout period from 100ms to 1 second (which should be more than enough).

I agree with you on taking this approach.

Maybe it would be helpful to create a small utility to dump out the timeout value that others can run? Then we could run it against the GC games in our collection to verify your observation?
 
I agree with you on taking this approach.

Maybe it would be helpful to create a small utility to dump out the timeout value that others can run? Then we could run it against the GC games in our collection to verify your observation?
The problem with that would be that unless the users actually know what they're looking at, the issue of false positives wouldn't be resolved. If the detection routine finds false positives, it'll find those in the games of people running that utility. Those people won't know any better most likely, and so will just assume it's "working" with those games. I think it probably needs some with some expertise (e.g. tueidj) to look at a bunch of games and check them.
 
Would it be possible to emulate saves on a solid state device, such as an SD card, while still loading the actually game from USB?
To keep things simple the file used for memory card emulation must be on the same device as the ISO file i.e. only one device can be mounted at a time. Otherwise more code and memory space is required to keep track of the individual FATs. The issue also affected some SD cards, they don't have as much overhead when doing a read/write (only one IOS command instead of three) but there's a higher chance of fragmentation with smaller cluster sizes.
Maybe it would be helpful to create a small utility to dump out the timeout value that others can run? Then we could run it against the GC games in our collection to verify your observation?
Not sure how you expect this to work, testing individual writes to the drive isn't sufficient because it doesn't take into account all the other stuff that might be happening at the same time (concurrent reads, FAT reads required due to fragmentation, other device emulation, IOS delays, different cluster sizes...)
i assume that regular GC mem cards arent an issue ?
Not from what I can tell. Even if there is a rare case where a write to a real memcard takes too long, it can just be removed and reinserted like the game asks.
 
Would it be possible to emulate saves on a solid state device, such as an SD card, while still loading the actually game from USB?
To keep things simple the file used for memory card emulation must be on the same device as the ISO file i.e. only one device can be mounted at a time. Otherwise more code and memory space is required to keep track of the individual FATs. The issue also affected some SD cards, they don't have as much overhead when doing a read/write (only one IOS command instead of three) but there's a higher chance of fragmentation with smaller cluster sizes.

ahh well it was worth a shot
 
Why not using the NAND, the Memory Card data being a save file on Wii?

Just a random idea, but I think it's not that bad.

I think of it as a save file which is named "Devolution" or something...
 
He also said he will probably make a blog at some point in the development, or after release, to explain how devolution is working.


Thanks for the update on your current progress with the memory card.
 
Not that you particulary care about providing updates on development properly. Everyone else would have used a blog, and since you are most active on gbatemp you could always have used your personal gbatemp blog,eh?
Yeah that's a much better use of time, instead of spending time actually developing, spend that time posting updates on a blog for people, 90% of whom probably won't understand the majority of the stuff posted anyway. He's posted a few posts about the technical side of things and said he'll probably do a bit of a write up once it's finished. I think that's enough really.


 
Not that you particulary care about providing updates on development properly. Everyone else would have used a blog, and since you are most active on gbatemp you could always have used your personal gbatemp blog,eh?
Yeah that's a much better use of time, instead of spending time actually developing, spend that time posting updates on a blog for people, 90% of whom probably won't understand the majority of the stuff posted anyway. He's posted a few posts about the technical side of things and said he'll probably do a bit of a write up once it's finished. I think that's enough really.
Cool down. I was reffering to the bits of information tueidj provided that are scattered all over this 40 pages thread and yet he complained about all the offtopic posts in this speculation thread rather than posting the same bits of information ordered in a blog.
 
  • Like
Reactions: 1 person
Not that you particulary care about providing updates on development properly. Everyone else would have used a blog, and since you are most active on gbatemp you could always have used your personal gbatemp blog,eh?
Yeah that's a much better use of time, instead of spending time actually developing, spend that time posting updates on a blog for people, 90% of whom probably won't understand the majority of the stuff posted anyway. He's posted a few posts about the technical side of things and said he'll probably do a bit of a write up once it's finished. I think that's enough really.


 
  • Like
Reactions: 1 person
Status
Not open for further replies.

Site & Scene News

Popular threads in this forum