Calculate SHA256 checksum for later use.

This commit is contained in:
Brandon Wright 2018-04-24 17:06:32 -05:00
parent 14c8ebba00
commit bbfeb19b08
9 changed files with 21 additions and 5 deletions

View File

@ -179,7 +179,8 @@ snes9x_gtk_SOURCES += \
../snapshot.cpp \ ../snapshot.cpp \
../screenshot.cpp \ ../screenshot.cpp \
../movie.cpp \ ../movie.cpp \
../statemanager.cpp ../statemanager.cpp \
../sha256.cpp
# ASMCPU Doesn't exist anymore. # ASMCPU Doesn't exist anymore.
snes9x_gtk_SOURCES += \ snes9x_gtk_SOURCES += \

View File

@ -44,6 +44,7 @@ SOURCES_CXX := $(CORE_DIR)/apu/apu.cpp \
$(CORE_DIR)/seta010.cpp \ $(CORE_DIR)/seta010.cpp \
$(CORE_DIR)/seta011.cpp \ $(CORE_DIR)/seta011.cpp \
$(CORE_DIR)/seta018.cpp \ $(CORE_DIR)/seta018.cpp \
$(CORE_DIR)/sha256.cpp \
$(CORE_DIR)/snapshot.cpp \ $(CORE_DIR)/snapshot.cpp \
$(CORE_DIR)/snes9x.cpp \ $(CORE_DIR)/snes9x.cpp \
$(CORE_DIR)/spc7110.cpp \ $(CORE_DIR)/spc7110.cpp \

View File

@ -550,7 +550,7 @@ bool retro_load_game(const struct retro_game_info *game)
if(!environ_cb || !environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt)) if(!environ_cb || !environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt))
{ {
return false return false;
} }
S9xGraphicsDeinit(); S9xGraphicsDeinit();

View File

@ -219,6 +219,7 @@
#include "cheats.h" #include "cheats.h"
#include "movie.h" #include "movie.h"
#include "display.h" #include "display.h"
#include "sha256.h"
#ifndef SET_UI_COLOR #ifndef SET_UI_COLOR
#define SET_UI_COLOR(r, g, b) ; #define SET_UI_COLOR(r, g, b) ;
@ -2671,7 +2672,10 @@ void CMemory::InitROM (void)
// CRC32 // CRC32
if (!Settings.BS || Settings.BSXItself) // Not BS Dump if (!Settings.BS || Settings.BSXItself) // Not BS Dump
{
ROMCRC32 = caCRC32(ROM, CalculatedSize); ROMCRC32 = caCRC32(ROM, CalculatedSize);
sha256sum(ROM, CalculatedSize, ROMSHA256);
}
else // Convert to correct format before scan else // Convert to correct format before scan
{ {
int offset = HiROM ? 0xffc0 : 0x7fc0; int offset = HiROM ? 0xffc0 : 0x7fc0;
@ -2683,6 +2687,7 @@ void CMemory::InitROM (void)
ROM[offset + 23] = 0x00; ROM[offset + 23] = 0x00;
// Calc // Calc
ROMCRC32 = caCRC32(ROM, CalculatedSize); ROMCRC32 = caCRC32(ROM, CalculatedSize);
sha256sum(ROM, CalculatedSize, ROMSHA256);
// Convert back // Convert back
ROM[offset + 22] = BSMagic0; ROM[offset + 22] = BSMagic0;
ROM[offset + 23] = BSMagic1; ROM[offset + 23] = BSMagic1;

View File

@ -268,6 +268,7 @@ struct CMemory
uint32 ROMChecksum; uint32 ROMChecksum;
uint32 ROMComplementChecksum; uint32 ROMComplementChecksum;
uint32 ROMCRC32; uint32 ROMCRC32;
unsigned char ROMSHA256[32];
int32 ROMFramesPerSecond; int32 ROMFramesPerSecond;
bool8 HiROM; bool8 HiROM;

View File

@ -8,7 +8,7 @@
OS = `uname -s -r -m|sed \"s/ /-/g\"|tr \"[A-Z]\" \"[a-z]\"|tr \"/()\" \"___\"` OS = `uname -s -r -m|sed \"s/ /-/g\"|tr \"[A-Z]\" \"[a-z]\"|tr \"/()\" \"___\"`
BUILDDIR = . BUILDDIR = .
OBJECTS = ../apu/apu.o ../apu/bapu/dsp/sdsp.o ../apu/bapu/dsp/SPC_DSP.o ../apu/bapu/smp/smp.o ../apu/bapu/smp/smp_state.o ../bsx.o ../c4.o ../c4emu.o ../cheats.o ../cheats2.o ../clip.o ../conffile.o ../controls.o ../cpu.o ../cpuexec.o ../cpuops.o ../crosshairs.o ../dma.o ../dsp.o ../dsp1.o ../dsp2.o ../dsp3.o ../dsp4.o ../fxinst.o ../fxemu.o ../gfx.o ../globals.o ../logger.o ../memmap.o ../msu1.o ../movie.o ../obc1.o ../ppu.o ../stream.o ../sa1.o ../sa1cpu.o ../screenshot.o ../sdd1.o ../sdd1emu.o ../seta.o ../seta010.o ../seta011.o ../seta018.o ../snapshot.o ../snes9x.o ../spc7110.o ../srtc.o ../tile.o ../filter/2xsai.o ../filter/blit.o ../filter/epx.o ../filter/hq2x.o ../filter/snes_ntsc.o ../statemanager.o unix.o x11.o OBJECTS = ../apu/apu.o ../apu/bapu/dsp/sdsp.o ../apu/bapu/dsp/SPC_DSP.o ../apu/bapu/smp/smp.o ../apu/bapu/smp/smp_state.o ../bsx.o ../c4.o ../c4emu.o ../cheats.o ../cheats2.o ../clip.o ../conffile.o ../controls.o ../cpu.o ../cpuexec.o ../cpuops.o ../crosshairs.o ../dma.o ../dsp.o ../dsp1.o ../dsp2.o ../dsp3.o ../dsp4.o ../fxinst.o ../fxemu.o ../gfx.o ../globals.o ../logger.o ../memmap.o ../msu1.o ../movie.o ../obc1.o ../ppu.o ../stream.o ../sa1.o ../sa1cpu.o ../screenshot.o ../sdd1.o ../sdd1emu.o ../seta.o ../seta010.o ../seta011.o ../seta018.o ../snapshot.o ../snes9x.o ../spc7110.o ../srtc.o ../tile.o ../filter/2xsai.o ../filter/blit.o ../filter/epx.o ../filter/hq2x.o ../filter/snes_ntsc.o ../statemanager.o ../sha256.o unix.o x11.o
DEFS = -DMITSHM DEFS = -DMITSHM
ifdef S9XDEBUGGER ifdef S9XDEBUGGER

View File

@ -388,6 +388,7 @@
</CustomBuild> </CustomBuild>
<ClInclude Include="..\msu1.h" /> <ClInclude Include="..\msu1.h" />
<ClInclude Include="..\statemanager.h" /> <ClInclude Include="..\statemanager.h" />
<ClInclude Include="..\sha256.h" />
<CustomBuild Include="..\stream.h" /> <CustomBuild Include="..\stream.h" />
<CustomBuild Include="..\tile.h" /> <CustomBuild Include="..\tile.h" />
<ClInclude Include="..\unzip\crypt.h" /> <ClInclude Include="..\unzip\crypt.h" />
@ -517,6 +518,7 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">true</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="..\statemanager.cpp" /> <ClCompile Include="..\statemanager.cpp" />
<ClCompile Include="..\sha256.cpp" />
<ClCompile Include="..\stream.cpp" /> <ClCompile Include="..\stream.cpp" />
<ClCompile Include="..\tile.cpp" /> <ClCompile Include="..\tile.cpp" />
<ClCompile Include="..\unzip\ioapi.c" /> <ClCompile Include="..\unzip\ioapi.c" />

View File

@ -48,6 +48,9 @@
<ClInclude Include="..\statemanager.h"> <ClInclude Include="..\statemanager.h">
<Filter>Emu</Filter> <Filter>Emu</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\sha256.h">
<Filter>Emu</Filter>
</ClInclude>
<ClInclude Include="..\unzip\crypt.h"> <ClInclude Include="..\unzip\crypt.h">
<Filter>UnZip</Filter> <Filter>UnZip</Filter>
</ClInclude> </ClInclude>
@ -398,6 +401,9 @@
<ClCompile Include="..\statemanager.cpp"> <ClCompile Include="..\statemanager.cpp">
<Filter>Emu</Filter> <Filter>Emu</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\sha256.cpp">
<Filter>Emu</Filter>
</ClCompile>
<ClCompile Include="..\stream.cpp"> <ClCompile Include="..\stream.cpp">
<Filter>Emu</Filter> <Filter>Emu</Filter>
</ClCompile> </ClCompile>