diff options
author | Twinaphex | 2015-02-23 07:00:58 +1100 |
---|---|---|
committer | Twinaphex | 2015-02-23 07:00:58 +1100 |
commit | e12958f2fd223e0c829e6c2b226c75d8dc377315 (patch) | |
tree | 6456db47198343fd1ddaa3ad752f6612534815bd /source/sdd1.c | |
parent | 7114688cf0f5707768135ec05184635b34d54f79 (diff) | |
parent | ca3d2141cd95e280d250fadb88b42a50865a3197 (diff) | |
download | snes9x2005-e12958f2fd223e0c829e6c2b226c75d8dc377315.tar.gz snes9x2005-e12958f2fd223e0c829e6c2b226c75d8dc377315.tar.bz2 snes9x2005-e12958f2fd223e0c829e6c2b226c75d8dc377315.zip |
Merge pull request #3 from mwksoul/master
Support for S-DD1 games without graphics packs
Diffstat (limited to 'source/sdd1.c')
-rw-r--r-- | source/sdd1.c | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/source/sdd1.c b/source/sdd1.c index 79b06f6..c61e116 100644 --- a/source/sdd1.c +++ b/source/sdd1.c @@ -89,14 +89,9 @@ #include "snes9x.h" #include "memmap.h" -#include "ppu.h" #include "sdd1.h" #include "display.h" -#ifdef __linux -#include <unistd.h> -#endif - void S9xSetSDD1MemoryMap(uint32_t bank, uint32_t value) { bank = 0xc00 + bank * 0x100; @@ -131,53 +126,3 @@ void S9xSDD1PostLoadState() for (i = 0; i < 4; i++) S9xSetSDD1MemoryMap(i, Memory.FillRAM [0x4804 + i]); } - -static int S9xCompareSDD1LoggedDataEntries(const void* p1, const void* p2) -{ - uint8_t* b1 = (uint8_t*) p1; - uint8_t* b2 = (uint8_t*) p2; - uint32_t a1 = (*b1 << 16) + (*(b1 + 1) << 8) + *(b1 + 2); - uint32_t a2 = (*b2 << 16) + (*(b2 + 1) << 8) + *(b2 + 2); - - return (a1 - a2); -} - -void S9xSDD1SaveLoggedData() -{ - if (Memory.SDD1LoggedDataCount != Memory.SDD1LoggedDataCountPrev) - { - qsort(Memory.SDD1LoggedData, Memory.SDD1LoggedDataCount, 8, - S9xCompareSDD1LoggedDataEntries); - - FILE* fs = fopen(S9xGetFilename("dat"), "wb"); - - if (fs) - { - fwrite(Memory.SDD1LoggedData, 8, - Memory.SDD1LoggedDataCount, fs); - fclose(fs); -#if defined(__linux) - chown(S9xGetFilename("dat"), getuid(), getgid()); -#endif - } - Memory.SDD1LoggedDataCountPrev = Memory.SDD1LoggedDataCount; - } -} - -void S9xSDD1LoadLoggedData() -{ - FILE* fs = fopen(S9xGetFilename("dat"), "rb"); - - Memory.SDD1LoggedDataCount = Memory.SDD1LoggedDataCountPrev = 0; - - if (fs) - { - int c = fread(Memory.SDD1LoggedData, 8, - MEMMAP_MAX_SDD1_LOGGED_ENTRIES, fs); - - if (c != EOF) - Memory.SDD1LoggedDataCount = Memory.SDD1LoggedDataCountPrev = c; - fclose(fs); - } -} - |