initial commit

This commit is contained in:
2014-01-18 15:06:11 +01:00
parent 3fabb8dcf8
commit 768bec39b3
408 changed files with 171325 additions and 2 deletions

Binary file not shown.

View File

@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ndsbuilder", "ndsbuilder\ndsbuilder.vcproj", "{03D811C7-1EEE-4FB9-9A07-820DD13BEE01}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{03D811C7-1EEE-4FB9-9A07-820DD13BEE01}.Debug|Win32.ActiveCfg = Debug|Win32
{03D811C7-1EEE-4FB9-9A07-820DD13BEE01}.Debug|Win32.Build.0 = Debug|Win32
{03D811C7-1EEE-4FB9-9A07-820DD13BEE01}.Release|Win32.ActiveCfg = Release|Win32
{03D811C7-1EEE-4FB9-9A07-820DD13BEE01}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,112 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
typedef unsigned int u32;
typedef unsigned short u16;
typedef unsigned char u8;
unsigned int filesize(FILE * f)
{
fseek(f, 0, SEEK_END);
unsigned int size = ftell(f);
fseek(f, 0, SEEK_SET);
return size;
}
unsigned int align(unsigned int value)
{
return value + (4-(value % 4));
}
struct NDSMicroHeader {
char title[12];
u32 gamecode;
u16 makercode;
u8 unitcode;
u8 seed;
u8 capacity;
char reserved[9];
u8 version;
u8 autostart;
u32 arm9_offset;
u32 arm9_entry;
u32 arm9_address;
u32 arm9_size;
u32 arm7_offset;
u32 arm7_entry;
u32 arm7_address;
u32 arm7_size;
NDSMicroHeader() {
assert(sizeof(*this) == 64);
memset(this, 0, sizeof(*this));
arm9_entry = arm9_address = 0x2000000;
arm7_entry = arm7_address = 0x37F8000;
arm9_offset = 64;
}
void build(FILE * arm7, FILE * arm9) {
arm9_size = filesize(arm9);
arm7_size = filesize(arm7);
arm7_offset = 64 + align(arm9_size);
}
};
int main(int argc, char ** argv)
{
NDSMicroHeader header;
FILE * arm9 = 0;
FILE * arm7 = 0;
FILE * nds = 0;
u8 * buf = 0;
if ( argc >= 4 ) {
nds = fopen(argv[1], "wb");
if ( nds == 0 ) {
fprintf(stderr, "Could not open %s\n", argv[1]);
goto error;
}
arm9 = fopen(argv[2], "rb");
if ( arm9 == 0 ) {
fprintf(stderr, "Could not open %s\n", argv[2]);
goto error;
}
arm7 = fopen(argv[3], "rb");
if ( arm7 == 0 ) {
fprintf(stderr, "Could not open %s\n", argv[3]);
goto error;
}
if ( argc >= 5 )
strncpy(header.title, argv[4], 12);
header.build(arm7, arm9);
fwrite(& header, sizeof(NDSMicroHeader), 1, nds);
buf = new u8[header.arm9_size];
fread(buf, header.arm9_size, 1, arm9);
fseek(nds, header.arm9_offset, SEEK_SET);
fwrite(buf, header.arm9_size, 1, nds);
delete buf;
buf = new u8[header.arm7_size];
fread(buf, header.arm7_size, 1, arm7);
fseek(nds, header.arm7_offset, SEEK_SET);
fwrite(buf, header.arm7_size, 1, nds);
delete buf;
} else {
printf("Usage : %s <nds> <arm9 binary> <arm7 binary> [title]\n", argv[0]);
}
error:
if ( arm9 )
fclose(arm9);
if ( arm7 )
fclose(arm7);
if ( nds )
fclose(nds);
return 0;
}

View File

@@ -0,0 +1,185 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="ndsbuilder"
ProjectGUID="{03D811C7-1EEE-4FB9-9A07-820DD13BEE01}"
RootNamespace="ndsbuilder"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
GenerateDebugInformation="true"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
GenerateDebugInformation="true"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\main.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>