• Login
  • Register
  • Dolphin Forums
  • Home
  • FAQ
  • Download
  • Wiki
  • Code


Dolphin, the GameCube and Wii emulator - Forums › Dolphin Emulator Discussion and Support › Development Discussion v
« Previous 1 ... 96 97 98 99 100 ... 117 Next »

Uncompress Savestate
View New Posts | View Today's Posts

Thread Rating:
  • 1 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Thread Modes
Uncompress Savestate
12-24-2009, 12:41 AM
#1
Vash
Unregistered
 
Hi, I need to decompress the savestates of the dolphin due to some hack I'm doing in some wii games. It is possible to do it with some flag that I can't find?
Reply
12-27-2009, 11:10 AM
#2
LuisR14
Unregistered
 
dolphin doesn't compress savestates Tongue
Reply
12-27-2009, 11:39 PM
#3
Vash
Unregistered
 
I saw the LZO functions in the code, but i guess it's chuncked so it would take a loooot to uncompress it manually..
Reply
12-29-2009, 01:44 PM
#4
LuisR14
Unregistered
 
dolphin doesn't compress the savestates >_>
Reply
12-29-2009, 02:16 PM
#5
sl1nk3 Offline
Dolphin Dev
**********
Developers (Some Administrators and Super Moderators)
Posts: 104
Threads: 0
Joined: Apr 2009
(12-29-2009, 01:44 PM)LuisR14 Wrote: dolphin doesn't compress the savestates >_>

The name of this function should be pretty much self explanatory :
http://code.google.com/p/dolphin-emu/source/browse/trunk/Source/Core/Core/Src/State.cpp#151
Find
Reply
12-29-2009, 06:24 PM
#6
LuisR14
Unregistered
 
T_T (dam whoever told me that it doesn't >_>), and seeing from that i'd like to see an uncompressed save state Smile
Reply
12-30-2009, 08:07 AM
#7
Phoenix
Unregistered
 
Hi All!
I recently developed a decompressor for dolphin's save states. It should work fine 'cose is based on the decompression code of dolphin.

Reading the "loading save state code", i noticed something strange.

Code:
fread(&header, sizeof(state_header), 1, f);
    
...
sz = header.sz;
bCompressedState = (sz != 0);
if (bCompressedState)
{
    Core::DisplayMessage("Decompressing State...", 500);

    lzo_uint i = 0;
    buffer = new u8[sz];
...
    while (true)
    {
        lzo_uint cur_len = 0;
        lzo_uint new_len = 0;
        if (fread(&cur_len, 1, sizeof(int), f) == 0)
            break;
        if (feof(f))
            break;  // don't know if this happens.
        fread(out, 1, cur_len, f);
        int res = lzo1x_decompress(out, cur_len, (buffer + i), &new_len, NULL);

        i += new_len;
    }
}
else
{
    fseek(f, 0, SEEK_END);
    sz = (int)(ftell(f) - sizeof(int));
    fseek(f, sizeof(int), SEEK_SET);
    buffer = new u8[sz];
             fread(buffer, 1, sz, f);
}

Checking if the save state is compressed or not. If the save is decompressed, the code reads in the buffer the wrong data i think:
Code:
fseek(f, 0, SEEK_END);
sz = (int)(ftell(f) - sizeof(int)); <-- should exclude the header size, not int size
fseek(f, sizeof(int), SEEK_SET); <-- should seek after header size, not int size
buffer = new u8[sz];
fread(buffer, 1, sz, f);
Reply
« Next Oldest | Next Newest »


  • View a Printable Version
  • Subscribe to this thread
Forum Jump:


Users browsing this thread: 1 Guest(s)



Powered By MyBB | Theme by Fragma

Linear Mode
Threaded Mode