Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed TestSpawn binaries and added an updated version in project form.
- Loading branch information
1 parent
9229ffd
commit 256c6ca
Showing
11 changed files
with
439 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "TestSpawn/sadx-mod-loader"] | ||
path = TestSpawn/sadx-mod-loader | ||
url = https://github.com/sonicretro/sadx-mod-loader.git |
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
#include "stdafx.h" | ||
|
||
#include <iostream> | ||
#include <SADXModLoader.h> | ||
#include <shellapi.h> // for CommandLineToArgvW | ||
#include <string> | ||
#include <vector> | ||
|
||
static const void* jumpAddress = (const void*)0x0040C318; | ||
|
||
__declspec(naked) void ForceTrialMode() | ||
{ | ||
__asm | ||
{ | ||
mov GameMode, GameModes_Trial | ||
jmp jumpAddress | ||
} | ||
} | ||
|
||
extern "C" | ||
{ | ||
__declspec(dllexport) ModInfo SADXModInfo = { ModLoaderVer }; | ||
|
||
__declspec(dllexport) void __cdecl Init(const char* path, const HelperFunctions& helperFunctions) | ||
{ | ||
int argc = 0; | ||
LPWSTR* argv = CommandLineToArgvW(GetCommandLineW(), &argc); | ||
bool spawnFlag = false; | ||
|
||
// Prevents CurrentCharacter from being overwritten. There could be other side effects, | ||
// but there are none that I've noticed thus far. | ||
std::vector<Uint8> nop(5, 0x90); | ||
WriteData((void*)0x00415007, nop.data(), nop.size()); | ||
|
||
// TODO: Start position via command line and/or ini. | ||
for (int i = 1; i < argc; i++) | ||
{ | ||
if (!wcscmp(argv[i], L"-testspawn")) | ||
{ | ||
WriteJump((void*)0x0040C115, ForceTrialMode); | ||
spawnFlag = true; | ||
continue; | ||
} | ||
|
||
if (!spawnFlag) | ||
continue; | ||
|
||
if (!wcscmp(argv[i], L"-level")) | ||
{ | ||
CurrentLevel = _wtoi(argv[++i]); | ||
PrintDebug("Loading level: %d\n", CurrentLevel); | ||
} | ||
else if (!wcscmp(argv[i], L"-act")) | ||
{ | ||
CurrentAct = _wtoi(argv[++i]); | ||
PrintDebug("Loading act: %d\n", CurrentAct); | ||
} | ||
else if (!wcscmp(argv[i], L"-character")) | ||
{ | ||
CurrentCharacter = _wtoi(argv[++i]); | ||
PrintDebug("Loading character: %d\n", CurrentCharacter); | ||
} | ||
} | ||
|
||
LocalFree(argv); | ||
return; | ||
|
||
/* | ||
#ifdef _DEBUG | ||
PrintDebug("Loading SpawnData\n"); | ||
#endif | ||
// TODO: GetPrivateProfile* | ||
std::string startDataPath = (std::string)path + "\\StartData.ini"; | ||
std::ifstream startDataStream(startDataPath); | ||
if (startDataStream.fail()) | ||
{ | ||
PrintDebug("Loading spawn data failed!\n"); | ||
} | ||
else | ||
{ | ||
while (!startDataStream.eof()) | ||
{ | ||
char currentLine[256]; | ||
startDataStream.getline(currentLine, 256); | ||
if (strlen(currentLine) == 0) continue; | ||
char nameBuffer[256]; | ||
char* name = nameBuffer; | ||
char valueBuffer[256]; | ||
char* value = valueBuffer; | ||
name = strtok(currentLine, "="); | ||
value = strtok(NULL, "="); | ||
if (strcmp(name, "level") == 0) | ||
{ | ||
CurrentLevel = atoi(value); | ||
#ifdef _DEBUG | ||
PrintDebug("Loading level: %d\n", CurrentLevel); | ||
#endif | ||
} | ||
else if (strcmp(name, "act") == 0) | ||
{ | ||
CurrentAct = atoi(value); | ||
#ifdef _DEBUG | ||
PrintDebug("Loading act: %d\n", CurrentAct); | ||
#endif | ||
} | ||
else if (strcmp(name, "character") == 0) | ||
{ | ||
CurrentCharacter = atoi(value); | ||
#ifdef _DEBUG | ||
PrintDebug("Loading character: %d\n", CurrentCharacter); | ||
#endif | ||
} | ||
} | ||
startDataStream.close(); | ||
#ifdef _DEBUG | ||
PrintDebug("Finished Loading Spawn!\n"); | ||
#endif | ||
} | ||
*/ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ItemGroup Label="ProjectConfigurations"> | ||
<ProjectConfiguration Include="Debug|Win32"> | ||
<Configuration>Debug</Configuration> | ||
<Platform>Win32</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Release|Win32"> | ||
<Configuration>Release</Configuration> | ||
<Platform>Win32</Platform> | ||
</ProjectConfiguration> | ||
</ItemGroup> | ||
<PropertyGroup Label="Globals"> | ||
<ProjectGuid>{2DDB084D-4609-425F-B178-F5FCFED260F2}</ProjectGuid> | ||
<Keyword>Win32Proj</Keyword> | ||
<RootNamespace>TestSpawn</RootNamespace> | ||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> | ||
</PropertyGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> | ||
<ConfigurationType>DynamicLibrary</ConfigurationType> | ||
<UseDebugLibraries>true</UseDebugLibraries> | ||
<PlatformToolset>v120_xp</PlatformToolset> | ||
<CharacterSet>Unicode</CharacterSet> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> | ||
<ConfigurationType>DynamicLibrary</ConfigurationType> | ||
<UseDebugLibraries>false</UseDebugLibraries> | ||
<PlatformToolset>v120_xp</PlatformToolset> | ||
<WholeProgramOptimization>true</WholeProgramOptimization> | ||
<CharacterSet>Unicode</CharacterSet> | ||
</PropertyGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||
<ImportGroup Label="ExtensionSettings"> | ||
</ImportGroup> | ||
<ImportGroup Label="Shared"> | ||
</ImportGroup> | ||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
</ImportGroup> | ||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
</ImportGroup> | ||
<PropertyGroup Label="UserMacros" /> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||
<LinkIncremental>true</LinkIncremental> | ||
<OutDir>$(SolutionDir)ModGenerator\Config\SADX\$(ProjectName)\</OutDir> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||
<LinkIncremental>false</LinkIncremental> | ||
<OutDir>$(SolutionDir)ModGenerator\Config\SADX\$(ProjectName)\</OutDir> | ||
</PropertyGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||
<ClCompile> | ||
<PrecompiledHeader>Use</PrecompiledHeader> | ||
<WarningLevel>Level3</WarningLevel> | ||
<Optimization>Disabled</Optimization> | ||
<SDLCheck>true</SDLCheck> | ||
<AdditionalIncludeDirectories>sadx-mod-loader\SADXModLoader\include</AdditionalIncludeDirectories> | ||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
</ClCompile> | ||
<Link> | ||
<SubSystem>Windows</SubSystem> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
</Link> | ||
<PreBuildEvent> | ||
<Command>xcopy /Y /D "$(ProjectDir)mod.ini" "$(OutDir)"</Command> | ||
</PreBuildEvent> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||
<ClCompile> | ||
<WarningLevel>Level3</WarningLevel> | ||
<PrecompiledHeader>Use</PrecompiledHeader> | ||
<Optimization>MaxSpeed</Optimization> | ||
<FunctionLevelLinking>true</FunctionLevelLinking> | ||
<IntrinsicFunctions>true</IntrinsicFunctions> | ||
<SDLCheck>true</SDLCheck> | ||
<AdditionalIncludeDirectories>sadx-mod-loader\SADXModLoader\include</AdditionalIncludeDirectories> | ||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
</ClCompile> | ||
<Link> | ||
<SubSystem>Windows</SubSystem> | ||
<EnableCOMDATFolding>true</EnableCOMDATFolding> | ||
<OptimizeReferences>true</OptimizeReferences> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
</Link> | ||
<PreBuildEvent> | ||
<Command>xcopy /Y /D "$(ProjectDir)mod.ini" "$(OutDir)"</Command> | ||
</PreBuildEvent> | ||
</ItemDefinitionGroup> | ||
<ItemGroup> | ||
<ClInclude Include="stdafx.h" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClCompile Include="stdafx.cpp"> | ||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> | ||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> | ||
</ClCompile> | ||
<ClCompile Include="TestSpawn.cpp" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="mod.ini" /> | ||
</ItemGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||
<ImportGroup Label="ExtensionTargets"> | ||
</ImportGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ItemGroup> | ||
<Filter Include="Source Files"> | ||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> | ||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> | ||
</Filter> | ||
<Filter Include="Header Files"> | ||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> | ||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions> | ||
</Filter> | ||
<Filter Include="Resource Files"> | ||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> | ||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> | ||
</Filter> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClInclude Include="stdafx.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClCompile Include="stdafx.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="TestSpawn.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="mod.ini"> | ||
<Filter>Resource Files</Filter> | ||
</None> | ||
</ItemGroup> | ||
</Project> |
3 changes: 2 additions & 1 deletion
3
ModGenerator/Config/SADX/TestSpawn/mod.ini → TestSpawn/mod.ini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
Name=TestSpawn | ||
Author=X-Hax | ||
Description=Used by SADXLVL2. Doesn't do anything on its own. | ||
DLLFile=TestSpawn.dll | ||
DLLFile=TestSpawn.dll | ||
Version=1.0 |
Submodule sadx-mod-loader
added at
dfe129
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// stdafx.cpp : source file that includes just the standard includes | ||
// TestSpawn.pch will be the pre-compiled header | ||
// stdafx.obj will contain the pre-compiled type information | ||
|
||
#include "stdafx.h" | ||
|
||
// TODO: reference any additional headers you need in STDAFX.H | ||
// and not in this file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#pragma once | ||
|
||
#include <iostream> | ||
#include <SADXModLoader.h> | ||
#include <shellapi.h> // for CommandLineToArgvW | ||
#include <string> | ||
#include <vector> |