Added E-Reader support to GBA core
This commit is contained in:
parent
c92f085a96
commit
d8f5baa663
332
VBA.vcproj
332
VBA.vcproj
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8,00"
|
||||
Version="8.00"
|
||||
Name="VisualBoyAdvance"
|
||||
ProjectGUID="{6D4C5EC8-933F-4C05-A1BF-498E658576DF}"
|
||||
RootNamespace="VBA"
|
||||
|
@ -129,115 +129,6 @@
|
|||
ExcludedFromBuild="true"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
OutputDirectory="$(ProjectDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ProjectDir)$(PlatformName)\$(ConfigurationName)_temp"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="1"
|
||||
CharacterSet="2"
|
||||
BuildLogFile="$(IntDir)\$(ProjectName)_BuildLog.htm"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
ExcludedFromBuild="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="MASM"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
MkTypLibCompatible="false"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/MP"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\dependencies\zlib;..\dependencies\libpng;"..\dependencies\File_Extractor-0.4.2\fex";..\dependencies\cximage;..\dependencies\msvc"
|
||||
PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;DEV_VERSION;BKPT_SUPPORT;CRT_SECURE_NO_WARNINGS;HAS_FILE_EXTRACTOR;C_CORE"
|
||||
StringPooling="false"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
SmallerTypeCheck="false"
|
||||
RuntimeLibrary="1"
|
||||
StructMemberAlignment="0"
|
||||
BufferSecurityCheck="false"
|
||||
EnableFunctionLevelLinking="false"
|
||||
EnableEnhancedInstructionSet="0"
|
||||
TreatWChar_tAsBuiltInType="false"
|
||||
UsePrecompiledHeader="0"
|
||||
ProgramDataBaseFileName="$(IntDir)\$(ProjectName).pdb"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1033"
|
||||
AdditionalIncludeDirectories=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
ExcludedFromBuild="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="nafxcwd.lib LIBCMTD.lib Vfw32.Lib OpenGL32.Lib dinput8.lib dxguid.lib ddraw.lib winmm.lib Dsound.lib"
|
||||
OutputFile="$(OutDir)\VisualBoyAdvance.exe"
|
||||
Version=""
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories=""
|
||||
GenerateManifest="true"
|
||||
AdditionalManifestDependencies="type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'"
|
||||
IgnoreDefaultLibraryNames="nafxcwd.lib;LIBCMTD.lib"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="1"
|
||||
EnableCOMDATFolding="1"
|
||||
OptimizeForWindows98="1"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
ExcludedFromBuild="true"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(ProjectDir)$(PlatformName)\$(ConfigurationName)"
|
||||
|
@ -360,6 +251,115 @@
|
|||
ExcludedFromBuild="true"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
OutputDirectory="$(ProjectDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ProjectDir)$(PlatformName)\$(ConfigurationName)_temp"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="1"
|
||||
CharacterSet="2"
|
||||
BuildLogFile="$(IntDir)\$(ProjectName)_BuildLog.htm"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
ExcludedFromBuild="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="MASM"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
MkTypLibCompatible="false"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/MP"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\dependencies\zlib;..\dependencies\libpng;"..\dependencies\File_Extractor-0.4.2\fex";..\dependencies\cximage;..\dependencies\msvc"
|
||||
PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;DEV_VERSION;BKPT_SUPPORT;CRT_SECURE_NO_WARNINGS;HAS_FILE_EXTRACTOR;C_CORE"
|
||||
StringPooling="false"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
SmallerTypeCheck="false"
|
||||
RuntimeLibrary="1"
|
||||
StructMemberAlignment="0"
|
||||
BufferSecurityCheck="false"
|
||||
EnableFunctionLevelLinking="false"
|
||||
EnableEnhancedInstructionSet="0"
|
||||
TreatWChar_tAsBuiltInType="false"
|
||||
UsePrecompiledHeader="0"
|
||||
ProgramDataBaseFileName="$(IntDir)\$(ProjectName).pdb"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1033"
|
||||
AdditionalIncludeDirectories=""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
ExcludedFromBuild="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="nafxcwd.lib LIBCMTD.lib Vfw32.Lib OpenGL32.Lib dinput8.lib dxguid.lib ddraw.lib winmm.lib Dsound.lib"
|
||||
OutputFile="$(OutDir)\VisualBoyAdvance.exe"
|
||||
Version=""
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories=""
|
||||
GenerateManifest="true"
|
||||
AdditionalManifestDependencies="type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'"
|
||||
IgnoreDefaultLibraryNames="nafxcwd.lib;LIBCMTD.lib"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="1"
|
||||
EnableCOMDATFolding="1"
|
||||
OptimizeForWindows98="1"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
ExcludedFromBuild="true"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|x64"
|
||||
OutputDirectory="$(ProjectDir)$(PlatformName)\$(ConfigurationName)"
|
||||
|
@ -528,16 +528,6 @@
|
|||
Outputs=""$(IntDir)\$(InputName).obj""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="Assembling $(InputFileName)..."
|
||||
CommandLine="nasm -D__DJGPP__ -f win64 -o "$(IntDir)\$(InputName).obj" "$(InputPath)"
"
|
||||
Outputs=""$(IntDir)\$(InputName).obj""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
|
@ -548,6 +538,16 @@
|
|||
Outputs=""$(IntDir)\$(InputName).obj""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="Assembling $(InputFileName)..."
|
||||
CommandLine="nasm -D__DJGPP__ -f win64 -o "$(IntDir)\$(InputName).obj" "$(InputPath)"
"
|
||||
Outputs=""$(IntDir)\$(InputName).obj""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
>
|
||||
|
@ -623,16 +623,6 @@
|
|||
Outputs=""$(IntDir)\$(InputName).obj""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="Assembling $(InputFileName)..."
|
||||
CommandLine="nasm -D__DJGPP__ -O1 -Isrc/ -f win64 -o "$(IntDir)\$(InputName).obj" "$(InputPath)"
"
|
||||
Outputs=""$(IntDir)\$(InputName).obj""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
|
@ -643,6 +633,16 @@
|
|||
Outputs=""$(IntDir)\$(InputName).obj""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="Assembling $(InputFileName)..."
|
||||
CommandLine="nasm -D__DJGPP__ -O1 -Isrc/ -f win64 -o "$(IntDir)\$(InputName).obj" "$(InputPath)"
"
|
||||
Outputs=""$(IntDir)\$(InputName).obj""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
>
|
||||
|
@ -667,16 +667,6 @@
|
|||
Outputs=""$(IntDir)\$(InputName).obj""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="Assembling $(InputFileName)..."
|
||||
CommandLine="nasm -D__DJGPP__ -O1 -Isrc/ -f win64 -o "$(IntDir)\$(InputName).obj" "$(InputPath)"
"
|
||||
Outputs=""$(IntDir)\$(InputName).obj""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
|
@ -687,6 +677,16 @@
|
|||
Outputs=""$(IntDir)\$(InputName).obj""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="Assembling $(InputFileName)..."
|
||||
CommandLine="nasm -D__DJGPP__ -O1 -Isrc/ -f win64 -o "$(IntDir)\$(InputName).obj" "$(InputPath)"
"
|
||||
Outputs=""$(IntDir)\$(InputName).obj""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
>
|
||||
|
@ -711,16 +711,6 @@
|
|||
Outputs=""$(IntDir)\$(InputName).obj""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="Assembling $(InputFileName)..."
|
||||
CommandLine="nasm -D__DJGPP__ -O1 -Isrc/ -f win64 -o "$(IntDir)\$(InputName).obj" "$(InputPath)"
"
|
||||
Outputs=""$(IntDir)\$(InputName).obj""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
|
@ -731,6 +721,16 @@
|
|||
Outputs=""$(IntDir)\$(InputName).obj""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="Assembling $(InputFileName)..."
|
||||
CommandLine="nasm -D__DJGPP__ -O1 -Isrc/ -f win64 -o "$(IntDir)\$(InputName).obj" "$(InputPath)"
"
|
||||
Outputs=""$(IntDir)\$(InputName).obj""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
>
|
||||
|
@ -755,16 +755,6 @@
|
|||
Outputs=""$(IntDir)\$(InputName).obj""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="Assembling $(InputFileName)..."
|
||||
CommandLine="nasm -D__DJGPP__ -O1 -Isrc/ -f win64 -o "$(IntDir)\$(InputName).obj" "$(InputPath)"
"
|
||||
Outputs=""$(IntDir)\$(InputName).obj""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
|
@ -775,6 +765,16 @@
|
|||
Outputs=""$(IntDir)\$(InputName).obj""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="Assembling $(InputFileName)..."
|
||||
CommandLine="nasm -D__DJGPP__ -O1 -Isrc/ -f win64 -o "$(IntDir)\$(InputName).obj" "$(InputPath)"
"
|
||||
Outputs=""$(IntDir)\$(InputName).obj""
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
>
|
||||
|
@ -911,6 +911,14 @@
|
|||
RelativePath=".\src\elf.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ereader.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\ereader.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\Flash.cpp"
|
||||
>
|
||||
|
@ -1387,7 +1395,7 @@
|
|||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
|
@ -1395,7 +1403,7 @@
|
|||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
|
|
49
src/GBA.cpp
49
src/GBA.cpp
|
@ -42,6 +42,11 @@
|
|||
#include "prof/prof.h"
|
||||
#endif
|
||||
|
||||
/* EReader
|
||||
----------------------------*/
|
||||
#include "ereader.h"
|
||||
/* ----------------------- */
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define _stricmp strcasecmp
|
||||
#endif
|
||||
|
@ -1732,8 +1737,21 @@ void CPUSoftwareInterrupt(int comment)
|
|||
VCOUNT);
|
||||
}
|
||||
#endif
|
||||
CPUSoftwareInterrupt();
|
||||
return;
|
||||
if((comment & 0xF8) != 0xE0)
|
||||
{
|
||||
CPUSoftwareInterrupt();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* ------- EReader -------- */
|
||||
if(CheckEReaderRegion())
|
||||
BIOS_EReader_ScanCard(comment);
|
||||
else
|
||||
CPUSoftwareInterrupt();
|
||||
return;
|
||||
/* ------------------------ */
|
||||
}
|
||||
}
|
||||
// This would be correct, but it causes problems if uncommented
|
||||
// else {
|
||||
|
@ -1961,6 +1979,19 @@ void CPUSoftwareInterrupt(int comment)
|
|||
case 0x1F:
|
||||
BIOS_MidiKey2Freq();
|
||||
break;
|
||||
/* ------- EReader -------- */
|
||||
case 0xE0:
|
||||
case 0xE1:
|
||||
case 0xE2:
|
||||
case 0xE3:
|
||||
case 0xE4:
|
||||
case 0xE5:
|
||||
case 0xE6:
|
||||
case 0xE7:
|
||||
if(CheckEReaderRegion())
|
||||
BIOS_EReader_ScanCard(comment);
|
||||
break;
|
||||
/* ------------------------ */
|
||||
case 0x2A:
|
||||
BIOS_SndDriverJmpTableCopy();
|
||||
// let it go, because we don't really emulate this function
|
||||
|
@ -3064,6 +3095,20 @@ void CPUReset()
|
|||
break;
|
||||
}
|
||||
}
|
||||
/*--------- EReader -----------*/
|
||||
switch(CheckEReaderRegion())
|
||||
{
|
||||
case 1: //US
|
||||
EReaderWriteMemory(0x8009134,0x46C0DFE0);
|
||||
break;
|
||||
case 2:
|
||||
EReaderWriteMemory(0x8008A8C,0x46C0DFE0);
|
||||
break;
|
||||
case 3:
|
||||
EReaderWriteMemory(0x80091A8,0x46C0DFE0);
|
||||
break;
|
||||
}
|
||||
/*----------------------------*/
|
||||
rtcReset();
|
||||
// clean registers
|
||||
memset(®[0], 0, sizeof(reg));
|
||||
|
|
|
@ -0,0 +1,735 @@
|
|||
#include <stdio.h>
|
||||
#include <malloc.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "GBA.h"
|
||||
#include<stdio.h>
|
||||
#include<afxwin.h>
|
||||
#include "GBAinline.h"
|
||||
#include "Globals.h"
|
||||
#include "ereader.h"
|
||||
|
||||
|
||||
#include "win32/stdafx.h"
|
||||
#include "win32/vba.h"
|
||||
#include "win32/MainWnd.h"
|
||||
#include "win32/FileDlg.h"
|
||||
#include "win32/WinResUtil.h"
|
||||
#include "win32/MainWnd.h"
|
||||
|
||||
|
||||
int eReaderSaveRAW = 1;
|
||||
|
||||
char US_Ereader[19] = "CARDE READERPSAE01";
|
||||
char JAP_Ereader[19] = "CARDE READERPEAJ01";
|
||||
char JAP_Ereader_plus[19] = "CARDEREADER+PSAJ01";
|
||||
char rom_info[19];
|
||||
|
||||
char Signature[0x29] = "E-Reader Dotcode -Created- by CaitSith2";
|
||||
|
||||
|
||||
unsigned char ShortDotCodeHeader[0x30] = {
|
||||
0x00, 0x30, 0x01, 0x01,
|
||||
0x00, 0x01, 0x05, 0x10,
|
||||
0x00, 0x00, 0x10, 0x12, //Constant data
|
||||
|
||||
0x00, 0x00, //Header First 2 bytes
|
||||
|
||||
0x02, 0x00, //Constant data
|
||||
|
||||
0x00, 0x00, //Header Second 2 bytes
|
||||
|
||||
0x10, 0x47, 0xEF, //Global Checksum 1
|
||||
|
||||
0x19, 0x00, 0x00, 0x00, 0x08, 0x4E, 0x49,
|
||||
0x4E, 0x54, 0x45, 0x4E, 0x44, 0x4F, 0x00, 0x22,
|
||||
0x00, 0x09, //Constant data
|
||||
|
||||
0x00, 0x00, //Header, last 8 bytes
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00,
|
||||
0x00, //Header Checksum
|
||||
0x57 //Global Checksum 2
|
||||
};
|
||||
|
||||
unsigned char LongDotCodeHeader[0x30] = {
|
||||
0x00, 0x30, 0x01, 0x02,
|
||||
0x00, 0x01, 0x08, 0x10,
|
||||
0x00, 0x00, 0x10, 0x12, //Constant Data
|
||||
|
||||
0x00, 0x00, //Header, first 2 bytes
|
||||
|
||||
0x01, 0x00, //Constant data
|
||||
|
||||
0x00, 0x00, //Header, second 2 bytes
|
||||
0x10, 0x9A, 0x99, //Global Checksum 1
|
||||
|
||||
0x19, 0x00, 0x00, 0x00, 0x08, 0x4E, 0x49,
|
||||
0x4E, 0x54, 0x45, 0x4E, 0x44, 0x4F, 0x00, 0x22,
|
||||
0x00, 0x09, //Constant data
|
||||
|
||||
|
||||
0x00, 0x00, //Header, last 8 bytes
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00,
|
||||
0x00, //Header Checksum
|
||||
0x57 //Global Checksum 2
|
||||
};
|
||||
|
||||
unsigned char shortheader[0x18] = {
|
||||
0x00, 0x02, 0x00, 0x01, 0x40, 0x10, 0x00, 0x1C,
|
||||
0x10, 0x6F, 0x40, 0xDA, 0x39, 0x25, 0x8E, 0xE0,
|
||||
0x7B, 0xB5, 0x98, 0xB6, 0x5B, 0xCF, 0x7F, 0x72
|
||||
};
|
||||
unsigned char longheader[0x18] = {
|
||||
0x00, 0x03, 0x00, 0x19, 0x40, 0x10, 0x00, 0x2C,
|
||||
0x0E, 0x88, 0xED, 0x82, 0x50, 0x67, 0xFB, 0xD1,
|
||||
0x43, 0xEE, 0x03, 0xC6, 0xC6, 0x2B, 0x2C, 0x93
|
||||
};
|
||||
|
||||
unsigned char dotcodeheader[0x48];
|
||||
unsigned char dotcodedata[0xB38];
|
||||
unsigned char dotcodetemp[0xB00];
|
||||
int dotcodepointer;
|
||||
int dotcodeinterleave;
|
||||
int decodestate;
|
||||
|
||||
u32 GFpow;
|
||||
|
||||
unsigned char *DotCodeData;
|
||||
char filebuffer[2048];
|
||||
|
||||
int dotcodesize;
|
||||
|
||||
/* EReader
|
||||
-----------------------------------------------------------*/
|
||||
|
||||
int OpenDotCodeFile(void) //If user cancels, return 0x301.
|
||||
{
|
||||
// ereaderDotCode();
|
||||
char *exts[] = { ".raw;*.bin",".*" };
|
||||
|
||||
theApp.szFile = "";
|
||||
|
||||
filebuffer[0] = 0;
|
||||
//getHandle()
|
||||
FileDlg file(0, //Get the proper handle somehow, and put it here.
|
||||
"",
|
||||
"E-Reader dot code (*.bin, *.raw)|*.bin;*.raw|All Files (*.*)|*.*||",
|
||||
0,
|
||||
"RAW",
|
||||
(LPCTSTR *)exts,
|
||||
NULL,
|
||||
"Load Nintendo E-Reader Dotcode",
|
||||
FALSE);
|
||||
if(file.DoModal() == IDOK)
|
||||
{
|
||||
theApp.szFile = file.GetPathName();
|
||||
//return
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int OpenOutputDotCodeFile(void)
|
||||
{
|
||||
|
||||
char *exts[] = { ".raw",".*" };
|
||||
|
||||
if(eReaderSaveRAW)
|
||||
{
|
||||
theApp.szFile = "";
|
||||
|
||||
filebuffer[0] = 0;
|
||||
//getHandle()
|
||||
FileDlg file(0, //Get the proper handle somehow, and put it here.
|
||||
"",
|
||||
"E-Reader dot code (*.raw)|*.raw|All Files (*.*)|*.*||",
|
||||
0,
|
||||
"RAW",
|
||||
(LPCTSTR *)exts,
|
||||
NULL,
|
||||
"Save Nintendo E-Reader Dotcode",
|
||||
TRUE);
|
||||
if(file.DoModal() == IDOK)
|
||||
{
|
||||
theApp.szFile = file.GetPathName();
|
||||
//return
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* ----------------------------------------------------- */
|
||||
|
||||
|
||||
|
||||
int CheckEReaderRegion(void) //US = 1, JAP = 2, JAP+ = 3
|
||||
{
|
||||
// return 0;
|
||||
int i;
|
||||
for(i=0;i<18;i++)
|
||||
rom_info[i] = rom[0xA0+i];
|
||||
rom_info[i] = 0;
|
||||
|
||||
if(!stricmp(rom_info,US_Ereader))
|
||||
return 1;
|
||||
if(!stricmp(rom_info,JAP_Ereader))
|
||||
return 2;
|
||||
if(!stricmp(rom_info,JAP_Ereader_plus))
|
||||
return 3;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int LoadDotCodeData(int size, u32* DCdata, unsigned long MEM1, unsigned long MEM2, int loadraw)
|
||||
{
|
||||
u32 temp1, temp2;
|
||||
int i,j;
|
||||
|
||||
unsigned char scanmap[28];
|
||||
int scantotal=0;
|
||||
|
||||
for(i=0;i<28;i++)
|
||||
scanmap[i] = 0;
|
||||
|
||||
unsigned char longdotcodescan[28] = {
|
||||
0xF1, 0xF1, 0xF1, 0xF1, 0xF1, 0xF1, 0xF1, 0xF1,
|
||||
0xF1, 0xF1, 0xF1, 0xF1, 0xF1, 0xF1, 0xF1, 0xF1,
|
||||
0xF1, 0xF1, 0xF1, 0xF1, 0xF1, 0xF1, 0xF1, 0xF1,
|
||||
0xF1, 0xF2, 0xB1, 0xB1
|
||||
};
|
||||
unsigned char shortdotcodescan[18] = {
|
||||
0xF1, 0xF1, 0xF1, 0xF1, 0xF1, 0xF1,
|
||||
0xF1, 0xF1, 0xF1, 0xF1, 0xF1, 0xF1,
|
||||
0xF1, 0xF1, 0xF1, 0xF2, 0xB1, 0xB1
|
||||
};
|
||||
|
||||
temp1 = CPUReadMemory(MEM1-4);
|
||||
for(i=0;i<0x60;i+=4)
|
||||
CPUWriteMemory((MEM2-8)+i,0);
|
||||
for(i=0;i<0x1860;i+=4)
|
||||
CPUWriteMemory(temp1+i,0);
|
||||
if(DCdata != NULL)
|
||||
{
|
||||
if(size==0xB60)
|
||||
{
|
||||
for(i=0;i<28;i++)
|
||||
{
|
||||
for(j=0,scantotal=0;j<0x68;j+=4)
|
||||
{
|
||||
scantotal += DCdata[((i*0x68)+j)>>2];
|
||||
}
|
||||
if(scantotal)
|
||||
scanmap[i] = longdotcodescan[i];
|
||||
}
|
||||
for(i=0;i<size;i+=4)
|
||||
{
|
||||
CPUWriteMemory(temp1+i+0x9C0,DCdata[i>>2]);
|
||||
}
|
||||
}
|
||||
else if (size==0x750)
|
||||
{
|
||||
for(i=0;i<18;i++)
|
||||
{
|
||||
if((DCdata[0] == 0x02011394) && (DCdata[1] == 0x0203E110) && (i == 0))
|
||||
continue;
|
||||
for(j=0,scantotal=0;j<0x68;j+=4)
|
||||
{
|
||||
scantotal += DCdata[((i*0x68)+j)>>2];
|
||||
}
|
||||
if(scantotal)
|
||||
scanmap[i] = longdotcodescan[i];
|
||||
}
|
||||
for(i=0;i<size;i+=4)
|
||||
{
|
||||
CPUWriteMemory(temp1+i,DCdata[i>>2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
CPUWriteMemory(MEM2-8,0x1860);
|
||||
CPUWriteMemory(MEM2-4,temp1);
|
||||
|
||||
|
||||
if(size==0xB60)
|
||||
{
|
||||
if(loadraw)
|
||||
{
|
||||
for(i=0;i<28;i++)
|
||||
CPUWriteByte(MEM2+0x18+i,scanmap[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
CPUWriteMemory(MEM2+0x18,0xF1F1F1F1);
|
||||
CPUWriteMemory(MEM2+0x18+4,0xF1F1F1F1);
|
||||
CPUWriteMemory(MEM2+0x18+8,0xF1F1F1F1);
|
||||
CPUWriteMemory(MEM2+0x18+12,0xF1F1F1F1);
|
||||
CPUWriteMemory(MEM2+0x18+16,0xF1F1F1F1);
|
||||
CPUWriteMemory(MEM2+0x18+20,0xF1F1F1F1);
|
||||
CPUWriteMemory(MEM2+0x18+24,0xB1B1F2F1);
|
||||
}
|
||||
CPUWriteMemory(MEM2+0x40,0x19);
|
||||
CPUWriteMemory(MEM2+0x44,0x34);
|
||||
}
|
||||
else if (size==0x750)
|
||||
{
|
||||
if(loadraw)
|
||||
{
|
||||
for(i=0;i<18;i++)
|
||||
CPUWriteByte(MEM2+i,scanmap[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
CPUWriteMemory(MEM2,0xF1F1F1F1);
|
||||
CPUWriteMemory(MEM2+4,0xF1F1F1F1);
|
||||
CPUWriteMemory(MEM2+8,0xF1F1F1F1);
|
||||
CPUWriteMemory(MEM2+12,0xF2F1F1F1);
|
||||
CPUWriteMemory(MEM2+16,0xB1B1);
|
||||
}
|
||||
CPUWriteMemory(MEM2+0x40,0x01);
|
||||
CPUWriteMemory(MEM2+0x44,0x12);
|
||||
}
|
||||
CPUWriteMemory(MEM2+0x48,0x3C);
|
||||
CPUWriteMemory(MEM2+0x4C,MEM2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void EReaderWriteMemory(u32 address, u32 value)
|
||||
{
|
||||
switch(address >> 24)
|
||||
{
|
||||
case 2:
|
||||
WRITE32LE(((u32 *)&workRAM[address & 0x3FFFF]), value);
|
||||
break;
|
||||
case 3:
|
||||
WRITE32LE(((u32 *)&internalRAM[address & 0x7FFF]), value);
|
||||
break;
|
||||
default:
|
||||
WRITE32LE(((u32 *)&rom[address & 0x1FFFFFF]), value);
|
||||
//rom[address & 0x1FFFFFF] = data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BIOS_EReader_ScanCard(int swi_num)
|
||||
{
|
||||
|
||||
int i,j,k;
|
||||
int dotcodetype;
|
||||
|
||||
int global1, global2;
|
||||
|
||||
FILE *f;
|
||||
|
||||
u32 mem_location;
|
||||
//Open dotcode bin/raw
|
||||
|
||||
if(swi_num == 0xE0)
|
||||
{
|
||||
dotcodepointer = 0;
|
||||
dotcodeinterleave = 0;
|
||||
decodestate = 0;
|
||||
|
||||
i=OpenDotCodeFile();
|
||||
if(i==0)
|
||||
{
|
||||
reg[0].I = 0x301;
|
||||
return;
|
||||
}
|
||||
f=fopen(theApp.szFile,"rb");
|
||||
//f=fopen(filebuffer,"rb");
|
||||
//f=fopen("dotcode4.raw","rb");
|
||||
if(f==NULL)
|
||||
{
|
||||
reg[0].I = 0x303;
|
||||
return;
|
||||
}
|
||||
fseek(f,0,SEEK_END);
|
||||
i=ftell(f);
|
||||
fseek(f,0,SEEK_SET);
|
||||
if((i==0xB60) || (i==0x750))
|
||||
{
|
||||
dotcodetype = 0;
|
||||
}
|
||||
else if ((i==0x81C) || (i==0x51C))
|
||||
{
|
||||
dotcodetype = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
fclose(f);
|
||||
reg[0].I = 0x303;
|
||||
return;
|
||||
}
|
||||
DotCodeData = (unsigned char*)malloc(i);
|
||||
if(DotCodeData == NULL)
|
||||
{
|
||||
reg[0].I = 0x303;
|
||||
return;
|
||||
}
|
||||
fread(DotCodeData,1,i,f);
|
||||
fclose(f);
|
||||
|
||||
if(dotcodetype == 0)
|
||||
{
|
||||
|
||||
switch(CheckEReaderRegion())
|
||||
{
|
||||
case 1: //US
|
||||
LoadDotCodeData(i,(u32 *)DotCodeData,0x2032D14,0x2028B28,1);
|
||||
EReaderWriteMemory(0x80091BA,0x46C0DFE2);
|
||||
break;
|
||||
case 2:
|
||||
LoadDotCodeData(i,(u32 *)DotCodeData,0x2006EC4,0x2002478,1);
|
||||
EReaderWriteMemory(0x8008B12,0x46C0DFE2);
|
||||
break;
|
||||
case 3:
|
||||
LoadDotCodeData(i,(u32 *)DotCodeData,0x202F8A4,0x2031034,1);
|
||||
EReaderWriteMemory(0x800922E,0x46C0DFE2);
|
||||
break;
|
||||
}
|
||||
reg[0].I = 0;
|
||||
free(DotCodeData);
|
||||
}
|
||||
else
|
||||
{
|
||||
//dotcodesize = i;
|
||||
if(i==0x81C)
|
||||
dotcodesize = 0xB60;
|
||||
else
|
||||
dotcodesize = 0x750;
|
||||
|
||||
|
||||
switch(CheckEReaderRegion())
|
||||
{
|
||||
case 1: //US
|
||||
LoadDotCodeData(dotcodesize,(u32 *)NULL,0x2032D14,0x2028B28,0);
|
||||
EReaderWriteMemory(0x80091BA,0x46C0DFE1);
|
||||
break;
|
||||
case 2:
|
||||
LoadDotCodeData(dotcodesize,(u32 *)NULL,0x2006EC4,0x2002478,0);
|
||||
EReaderWriteMemory(0x8008B12,0x46C0DFE1);
|
||||
break;
|
||||
case 3:
|
||||
LoadDotCodeData(dotcodesize,(u32 *)NULL,0x202F8A4,0x2031034,0);
|
||||
EReaderWriteMemory(0x800922E,0x46C0DFE1);
|
||||
break;
|
||||
}
|
||||
reg[0].I = 0;
|
||||
dotcodesize = i;
|
||||
}
|
||||
}
|
||||
else if (swi_num == 0xE1)
|
||||
{
|
||||
|
||||
switch(CheckEReaderRegion())
|
||||
{
|
||||
case 1: //US
|
||||
EReaderWriteMemory(0x80091BA,0xF8A5F03B);
|
||||
EReaderWriteMemory(0x3002F7C,0xEFE40000); //Beginning of Reed-Solomon decoder
|
||||
EReaderWriteMemory(0x3003144,0xCA00002F); //Fix required to Correct 16 "Erasures"
|
||||
EReaderWriteMemory(0x300338C,0xEFE50000); //End of Reed-Solomon decoder
|
||||
GFpow = 0x3000A6C;
|
||||
break;
|
||||
case 2:
|
||||
EReaderWriteMemory(0x8008B12,0xFB0BF035);
|
||||
EReaderWriteMemory(0x3002F88,0xEFE40000);
|
||||
EReaderWriteMemory(0x3003150,0xCA00002F);
|
||||
EReaderWriteMemory(0x3003398,0xEFE50000);
|
||||
GFpow = 0x3000A78;
|
||||
break;
|
||||
case 3:
|
||||
EReaderWriteMemory(0x800922E,0xF94BF04B);
|
||||
EReaderWriteMemory(0x3002F7C,0xEFE40000);
|
||||
EReaderWriteMemory(0x3003144,0xCA00002F);
|
||||
EReaderWriteMemory(0x300338C,0xEFE50000);
|
||||
GFpow = 0x3000A6C;
|
||||
break;
|
||||
}
|
||||
armNextPC -= 2;
|
||||
reg[15].I -= 2;
|
||||
|
||||
for(i=0,j=0;i<12;i++)
|
||||
j ^= DotCodeData[i];
|
||||
if(dotcodesize == 0x81C)
|
||||
{
|
||||
LongDotCodeHeader[0x2E] = j;
|
||||
LongDotCodeHeader[0x0D] = DotCodeData[0];
|
||||
LongDotCodeHeader[0x0C] = DotCodeData[1];
|
||||
LongDotCodeHeader[0x11] = DotCodeData[2];
|
||||
LongDotCodeHeader[0x10] = DotCodeData[3];
|
||||
|
||||
LongDotCodeHeader[0x26] = DotCodeData[4];
|
||||
LongDotCodeHeader[0x27] = DotCodeData[5];
|
||||
LongDotCodeHeader[0x28] = DotCodeData[6];
|
||||
LongDotCodeHeader[0x29] = DotCodeData[7];
|
||||
LongDotCodeHeader[0x2A] = DotCodeData[8];
|
||||
LongDotCodeHeader[0x2B] = DotCodeData[9];
|
||||
LongDotCodeHeader[0x2C] = DotCodeData[10];
|
||||
LongDotCodeHeader[0x2D] = DotCodeData[11];
|
||||
|
||||
|
||||
LongDotCodeHeader[0x12] = 0x10; //calculate Global Checksum 1
|
||||
LongDotCodeHeader[0x02] = 1; //Do not calculate Global Checksum 2
|
||||
|
||||
for(i=0x0C,j=0;i<0x81C;i++)
|
||||
{
|
||||
if(i&1)
|
||||
j += DotCodeData[i];
|
||||
else
|
||||
j += (DotCodeData[i] << 8);
|
||||
}
|
||||
j &= 0xFFFF;
|
||||
j ^= 0xFFFF;
|
||||
LongDotCodeHeader[0x13] = (j & 0xFF00) >> 8;
|
||||
LongDotCodeHeader[0x14] = (j & 0x00FF);
|
||||
|
||||
for(i=0,j=0;i<0x2F;i++)
|
||||
j+=LongDotCodeHeader[i];
|
||||
j &= 0xFF;
|
||||
for(i=1,global2=0;i<0x2C;i++)
|
||||
{
|
||||
for(k=0,global1=0;k<0x30;k++)
|
||||
{
|
||||
global1 ^= DotCodeData[((i-1)*0x30)+k+0x0C];
|
||||
}
|
||||
global2 += global1;
|
||||
}
|
||||
global2 += j;
|
||||
global2 &= 0xFF;
|
||||
global2 ^= 0xFF;
|
||||
LongDotCodeHeader[0x2F] = global2;
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ShortDotCodeHeader[0x2E] = j;
|
||||
ShortDotCodeHeader[0x0D] = DotCodeData[0];
|
||||
ShortDotCodeHeader[0x0C] = DotCodeData[1];
|
||||
ShortDotCodeHeader[0x11] = DotCodeData[2];
|
||||
ShortDotCodeHeader[0x10] = DotCodeData[3];
|
||||
|
||||
ShortDotCodeHeader[0x26] = DotCodeData[4];
|
||||
ShortDotCodeHeader[0x27] = DotCodeData[5];
|
||||
ShortDotCodeHeader[0x28] = DotCodeData[6];
|
||||
ShortDotCodeHeader[0x29] = DotCodeData[7];
|
||||
ShortDotCodeHeader[0x2A] = DotCodeData[8];
|
||||
ShortDotCodeHeader[0x2B] = DotCodeData[9];
|
||||
ShortDotCodeHeader[0x2C] = DotCodeData[10];
|
||||
ShortDotCodeHeader[0x2D] = DotCodeData[11];
|
||||
|
||||
ShortDotCodeHeader[0x12] = 0x10; //calculate Global Checksum 1
|
||||
ShortDotCodeHeader[0x02] = 1; //Do not calculate Global Checksum 2
|
||||
|
||||
for(i=0x0C,j=0;i<0x51C;i++)
|
||||
{
|
||||
if(i&1)
|
||||
j += DotCodeData[i];
|
||||
else
|
||||
j += (DotCodeData[i] << 8);
|
||||
}
|
||||
j &= 0xFFFF;
|
||||
j ^= 0xFFFF;
|
||||
ShortDotCodeHeader[0x13] = (j & 0xFF00) >> 8;
|
||||
ShortDotCodeHeader[0x14] = (j & 0x00FF);
|
||||
|
||||
for(i=0,j=0;i<0x2F;i++)
|
||||
j+=ShortDotCodeHeader[i];
|
||||
j &= 0xFF;
|
||||
for(i=1,global2=0;i<0x1C;i++)
|
||||
{
|
||||
for(k=0,global1=0;k<0x30;k++)
|
||||
{
|
||||
global1 ^= DotCodeData[((i-1)*0x30)+k+0x0C];
|
||||
}
|
||||
global2 += global1;
|
||||
}
|
||||
global2 += j;
|
||||
global2 &= 0xFF;
|
||||
global2 ^= 0xFF;
|
||||
ShortDotCodeHeader[0x2F] = global2;
|
||||
}
|
||||
|
||||
}
|
||||
else if (swi_num == 0xE2) //Header
|
||||
{
|
||||
switch(CheckEReaderRegion())
|
||||
{
|
||||
case 1: //US
|
||||
EReaderWriteMemory(0x80091BA,0xF8A5F03B);
|
||||
EReaderWriteMemory(0x300338C,0xEFE30000);
|
||||
GFpow = 0x3000A6C;
|
||||
break;
|
||||
case 2:
|
||||
EReaderWriteMemory(0x8008B12,0xFB0BF035);
|
||||
EReaderWriteMemory(0x3003398,0xEFE30000);
|
||||
GFpow = 0x3000A78;
|
||||
break;
|
||||
case 3:
|
||||
EReaderWriteMemory(0x800922E,0xF94BF04B);
|
||||
EReaderWriteMemory(0x300338C,0xEFE30000);
|
||||
GFpow = 0x3000A6C;
|
||||
break;
|
||||
}
|
||||
armNextPC -= 2;
|
||||
reg[15].I -= 2;
|
||||
}
|
||||
else if ((swi_num == 0xE3) || (swi_num == 0xE5)) //Dotcode data
|
||||
{
|
||||
if((reg[0].I >= 0) && (reg[0].I <= 0x10))
|
||||
{
|
||||
if(decodestate == 0)
|
||||
{
|
||||
for(i=0x17;i>=0;i--)
|
||||
{
|
||||
if((0x17 - i) < 8)
|
||||
j=CPUReadByte(GFpow + CPUReadByte(GFpow+0x200+i));
|
||||
else
|
||||
j=CPUReadByte(GFpow + CPUReadByte(GFpow+0x200+i)) ^ 0xFF;
|
||||
|
||||
dotcodeheader[(0x17-i)] = j;
|
||||
dotcodeheader[(0x17-i)+0x18] = j;
|
||||
dotcodeheader[(0x17-i)+0x30] = j;
|
||||
}
|
||||
for(i=0;i<28;i++)
|
||||
for(j=0;j<2;j++)
|
||||
dotcodedata[(i*0x68)+j] = dotcodeheader[(i*2)+j];
|
||||
dotcodeinterleave = dotcodeheader[7];
|
||||
decodestate = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
for(i=0x3F;i>=0;i--)
|
||||
{
|
||||
if((0x3F - i) < 0x30)
|
||||
j=CPUReadByte(GFpow + CPUReadByte(GFpow+0x200+i));
|
||||
else
|
||||
j=CPUReadByte(GFpow + CPUReadByte(GFpow+0x200+i)) ^ 0xFF;
|
||||
dotcodetemp[((0x3F-i)*dotcodeinterleave)+dotcodepointer] = j;
|
||||
}
|
||||
dotcodepointer++;
|
||||
|
||||
if((dotcodepointer == dotcodeinterleave))
|
||||
{
|
||||
switch(dotcodeinterleave)
|
||||
{
|
||||
case 0x1C:
|
||||
j = 0x724;
|
||||
k = 0x750 - j;
|
||||
break;
|
||||
case 0x2C:
|
||||
j = 0xB38;
|
||||
k = 0xB60 - j;
|
||||
break;
|
||||
}
|
||||
dotcodepointer = 0;
|
||||
for(i=2;i<j;i++)
|
||||
{
|
||||
if((i % 0x68) == 0)
|
||||
i+=2;
|
||||
dotcodedata[i] = dotcodetemp[dotcodepointer++];
|
||||
}
|
||||
if(swi_num == 0xE3)
|
||||
{
|
||||
f=fopen(theApp.szFile,"rb+");
|
||||
if(f!=NULL)
|
||||
{
|
||||
fwrite(dotcodedata,1,j,f);
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(OpenOutputDotCodeFile())
|
||||
{
|
||||
f=fopen(theApp.szFile,"wb");
|
||||
if(f!=NULL)
|
||||
{
|
||||
fwrite(dotcodedata,1,j,f);
|
||||
fwrite(Signature,1,0x28,f);
|
||||
if(j==0x724)
|
||||
{
|
||||
fputc(0x65,f);
|
||||
fputc(0x02,f);
|
||||
fputc(0x71,f);
|
||||
fputc(0x10,f);
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
free(DotCodeData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int base = 14;
|
||||
armState = reg[base].I & 1 ? false : true;
|
||||
if(armState) {
|
||||
reg[15].I = reg[base].I & 0xFFFFFFFC;
|
||||
armNextPC = reg[15].I;
|
||||
reg[15].I += 4;
|
||||
} else {
|
||||
reg[15].I = reg[base].I & 0xFFFFFFFE;
|
||||
armNextPC = reg[15].I;
|
||||
reg[15].I += 2;
|
||||
}
|
||||
}
|
||||
else if (swi_num == 0xE4)
|
||||
{
|
||||
reg[12].I = reg[13].I;
|
||||
if(decodestate == 0)
|
||||
{
|
||||
for(i=0;i<0x18;i++)
|
||||
{
|
||||
if(dotcodesize == 0x81C)
|
||||
j=longheader[i];
|
||||
else
|
||||
j=shortheader[i];
|
||||
|
||||
if(i<8)
|
||||
j=CPUReadByte(GFpow + 0x100 + j);
|
||||
else
|
||||
j=CPUReadByte(GFpow + 0x100 + (j ^ 0xFF));
|
||||
|
||||
CPUWriteByte(GFpow + 0x200 + (0x17 - i),j);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(dotcodepointer == 0)
|
||||
{
|
||||
for(i=0;i<0x30;i++)
|
||||
{
|
||||
if(dotcodesize == 0x81C)
|
||||
j=LongDotCodeHeader[i];
|
||||
else
|
||||
j=ShortDotCodeHeader[i];
|
||||
|
||||
j=CPUReadByte(GFpow + 0x100 + j);
|
||||
CPUWriteByte(GFpow + 0x200 + (0x3F - i),j);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
for(i=0;i<0x30;i++)
|
||||
{
|
||||
|
||||
j=DotCodeData[((dotcodepointer-1)*0x30)+0x0C+i];
|
||||
j=CPUReadByte(GFpow + 0x100 + j);
|
||||
CPUWriteByte(GFpow + 0x200 + (0x3F - i),j);
|
||||
}
|
||||
}
|
||||
for(i=0;i<16;i++)
|
||||
CPUWriteByte(GFpow + 0x258 + i,1); //16 Erasures on the parity bytes, to have them calculated.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
extern unsigned char *DotCodeData;
|
||||
extern char filebuffer[];
|
||||
extern int eReaderSaveRAW;
|
||||
|
||||
int OpenDotCodeFile(void);
|
||||
int CheckEReaderRegion(void);
|
||||
int LoadDotCodeData(int size, u32* DCdata, unsigned long MEM1, unsigned long MEM2);
|
||||
void EReaderWriteMemory(u32 address, u32 value);
|
||||
|
||||
void BIOS_EReader_ScanCard(int swi_num);
|
||||
|
|
@ -219,6 +219,9 @@ BEGIN_MESSAGE_MAP(MainWnd, CWnd)
|
|||
ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_SAVETYPE_FLASH512K, OnUpdateOptionsEmulatorSavetypeFlash512k)
|
||||
ON_COMMAND(ID_OPTIONS_EMULATOR_SAVETYPE_FLASH1M, OnOptionsEmulatorSavetypeFlash1m)
|
||||
ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_SAVETYPE_FLASH1M, OnUpdateOptionsEmulatorSavetypeFlash1m)
|
||||
|
||||
ON_COMMAND(ID_OPTIONS_EMULATOR_EREADER,OnOptionsEmulatorEreader)
|
||||
ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_EREADER,OnUpdateOptionsEmulatorEreader)
|
||||
ON_COMMAND(ID_OPTIONS_EMULATOR_USEBIOSFILE, OnOptionsEmulatorUsebiosfile)
|
||||
ON_UPDATE_COMMAND_UI(ID_OPTIONS_EMULATOR_USEBIOSFILE, OnUpdateOptionsEmulatorUsebiosfile)
|
||||
ON_COMMAND(ID_OPTIONS_EMULATOR_SKIPBIOS, OnOptionsEmulatorSkipbios)
|
||||
|
|
|
@ -258,6 +258,9 @@ class MainWnd : public CWnd
|
|||
afx_msg void OnUpdateOptionsEmulatorSavetypeFlash512k(CCmdUI* pCmdUI);
|
||||
afx_msg void OnOptionsEmulatorSavetypeFlash1m();
|
||||
afx_msg void OnUpdateOptionsEmulatorSavetypeFlash1m(CCmdUI* pCmdUI);
|
||||
|
||||
afx_msg void OnOptionsEmulatorEreader();
|
||||
afx_msg void OnUpdateOptionsEmulatorEreader(CCmdUI* pCmdUI);
|
||||
afx_msg void OnOptionsEmulatorUsebiosfile();
|
||||
afx_msg void OnUpdateOptionsEmulatorUsebiosfile(CCmdUI* pCmdUI);
|
||||
afx_msg void OnOptionsEmulatorSkipbios();
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include "../gb/gbPrinter.h"
|
||||
#include "../Link.h"
|
||||
#include <tchar.h>
|
||||
#include "../ereader.h"
|
||||
|
||||
extern int emulating;
|
||||
|
||||
|
@ -895,6 +896,19 @@ void MainWnd::OnOptionsEmulatorUsebiosfile()
|
|||
theApp.useBiosFile = !theApp.useBiosFile;
|
||||
}
|
||||
|
||||
void MainWnd::OnOptionsEmulatorEreader()
|
||||
{
|
||||
if(eReaderSaveRAW == 1)
|
||||
eReaderSaveRAW = 0;
|
||||
else
|
||||
eReaderSaveRAW = 1;
|
||||
}
|
||||
|
||||
void MainWnd::OnUpdateOptionsEmulatorEreader(CCmdUI* pCmdUI)
|
||||
{
|
||||
pCmdUI->SetCheck(eReaderSaveRAW == 1);
|
||||
}
|
||||
|
||||
void MainWnd::OnUpdateOptionsEmulatorUsebiosfile(CCmdUI* pCmdUI)
|
||||
{
|
||||
pCmdUI->SetCheck(theApp.useBiosFile);
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include "../Util.h"
|
||||
#include "../gb/gbGlobals.h"
|
||||
#include "../gb/gbPrinter.h"
|
||||
|
||||
#include "../ereader.h"
|
||||
/* Link
|
||||
---------------------*/
|
||||
#include "../Link.h"
|
||||
|
@ -1359,6 +1359,10 @@ void VBA::loadSettings()
|
|||
|
||||
lastFullscreen = (VIDEO_SIZE)regQueryDwordValue("lastFullscreen", VIDEO_1024x768);
|
||||
|
||||
eReaderSaveRAW = regQueryDwordValue("eReaderSaveRAW",1);
|
||||
if(eReaderSaveRAW < 0 || eReaderSaveRAW > 1)
|
||||
eReaderSaveRAW = 1;
|
||||
|
||||
languageOption = regQueryDwordValue("language", 1);
|
||||
if(languageOption < 0 || languageOption > 2)
|
||||
languageOption = 1;
|
||||
|
@ -2506,6 +2510,7 @@ void VBA::movieReadNext()
|
|||
|
||||
void VBA::saveSettings()
|
||||
{
|
||||
regSetDwordValue("eReaderSaveRAW", eReaderSaveRAW);
|
||||
regSetDwordValue("language", languageOption);
|
||||
|
||||
regSetStringValue("languageName", languageName);
|
||||
|
|
|
@ -69,31 +69,6 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
|||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\n"
|
||||
"#include ""resource2.h""\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""vba.rc2""\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
|
@ -1499,6 +1474,31 @@ END
|
|||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\n"
|
||||
"#include ""resource2.h""\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""vba.rc2""\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Menu
|
||||
|
@ -1817,7 +1817,7 @@ BEGIN
|
|||
MENUITEM "Flash 64 KB", ID_OPTIONS_EMULATOR_SAVETYPE_FLASH512K
|
||||
MENUITEM "Flash 128 KB", ID_OPTIONS_EMULATOR_SAVETYPE_FLASH1M
|
||||
END
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Save E-Reader RAW File", ID_OPTIONS_EMULATOR_EREADER
|
||||
MENUITEM "&Use BIOS file", ID_OPTIONS_EMULATOR_USEBIOSFILE
|
||||
MENUITEM "Skip BIOS", ID_OPTIONS_EMULATOR_SKIPBIOS
|
||||
MENUITEM "S&elect BIOS file...", ID_OPTIONS_EMULATOR_SELECTBIOSFILE
|
||||
|
|
|
@ -812,13 +812,15 @@
|
|||
#define ID_OUTPUTAPI_SOFTWAREMIXING 40348
|
||||
#define ID_OUTPUTAPI_CONFIGURATION 40349
|
||||
#define ID_OUTPUTAPI_OALCONFIGURATION 40350
|
||||
#define ID_OPTIONS_EMULATOR_EREADER 40351
|
||||
#define ID_EMULATOR_SAVEE 40351
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 161
|
||||
#define _APS_NEXT_COMMAND_VALUE 40351
|
||||
#define _APS_NEXT_COMMAND_VALUE 40352
|
||||
#define _APS_NEXT_CONTROL_VALUE 1270
|
||||
#define _APS_NEXT_SYMED_VALUE 103
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue