Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
halamix2 committed Sep 30, 2021
1 parent ef9a0b0 commit 8204359
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 38 deletions.
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ project ("StuntKit_modules")

# Include sub-projects.
add_subdirectory ("skScreen")
add_subdirectory ("skSpeedrun")
add_subdirectory ("skDebug")
add_subdirectory ("skWin10")
add_subdirectory ("skFreeze")
13 changes: 7 additions & 6 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@ Modules:
* Removes quality limitations in DirectX mode, when using Radeon graphics card
* `skDebug`
* Attempts to get last DirectX error and dave it in `log.txt` file
* `skWin10`
* Removes 0.5s freeze every 7m9.5s
* `skFreeze`
* Removes 0.5s freezes every 3-20 minutes (depending on the computer)
* Under Windows 10, the game freezes every 7m9.5s

# Installation and usage

1. Download [`skScreen.dll`](https://github.com/Halamix2/StuntKit_modules/releases/tag/v0.0.2a) and put it in the same folder as `StuntGP.exe`
2. Download [`StuntKit.zip`](https://github.com/Halamix2/StuntKit/releases/tag/0.0.1) and unpack files in the same folder as `StuntGP.exe`
3. If you want to play the game in resolution greater than 2048px (e.g. 2560x1440), download [LegacyD3DResolutionHack](https://github.com/UCyborg/LegacyD3DResolutionHack/releases/tag/v1.0.0), and unpack it in the same folder as `StuntGP.exe`
4. Edit `game.cfg` (if it doesn't exist, run `config.exe`) with a text editor, edit lines `DISPLAYRESWIDTH` and `DISPLAYRESHEIGHT` with requested resolution.
5. Run `StuntKit_D3D.exe` or `StuntKit_Glide.exe`, depending on wanted graphics API. These programs will load all `sk*.dll` modules and start the game.
2. Download any of the modules (e.g. [`StuntKit.dll`](https://github.com/Halamix2/StuntKit/releases/)) and put files in the same folder as `StuntGP.exe`
3. If you want to play the game in resolution greater than 2048px (e.g. 2560x1440), download [`StuntKit.dll`](https://github.com/Halamix2/StuntKit/releases/) and [LegacyD3DResolutionHack](https://github.com/UCyborg/LegacyD3DResolutionHack/releases/tag/v1.0.0), unpack it and put the files in the same folder as `StuntGP.exe`
4. Edit `game.cfg` (if it doesn't exist, run `config.exe`) with a text editor, update lines `DISPLAYRESWIDTH` and `DISPLAYRESHEIGHT` with desired resolution.
5. Run `StuntKit_D3D.exe` or `StuntKit_Glide.exe`, depending on used graphics API. If you don't know which one you should use, I suggest `stuntKit_D3D.exe`. These programs will load all `sk*.dll` modules and start the game.

![skScreen screenshot](https://i.imgur.com/xLSMScZ.png)
7 changes: 4 additions & 3 deletions skDebug/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ BOOL Initialize()
return FALSE;
}

OutputDebugString("skDebug loaded");
return TRUE;
}

BOOL Finalize() {
// this module doesn't need any cleanup yet
// it would if it wa hooking up to any API
OutputDebugString("skDebug:quitting");
OutputDebugString("skDebug: quitting");
//char[256], so 255 chars plus \0
char *errorAddress = 0x0;
if (gameVersion.getRelease() == Release::International && gameVersion.getAPI() == API::DirectX) {
Expand Down Expand Up @@ -60,13 +61,13 @@ BOOL Finalize() {
logFile.close();
}
else {
OutputDebugString("skDebug: can't write to log.txt!");
OutputDebugString("skDebug: can't write to log.txt!");
}
// MessageBox(NULL, "No DirectX error message found!", "skDebug seems clean", MB_OK | MB_ICONERROR);
}
}
else {
OutputDebugString("skDebug: broken c++");
OutputDebugString("skDebug: broken code on my side, this shouldn't ever happen");
// MessageBox(NULL, "Broken C++, you can't ship that! Address not set", "skDebug was written badly", MB_OK | MB_ICONERROR);
}
return TRUE;
Expand Down
16 changes: 10 additions & 6 deletions skScreen/binaryFix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ void BinaryFix::set3DRatio()
OutputDebugString(ss.str().c_str());

if (!address) {
throw std::runtime_error("set3DRatio: unknown game version");
throw std::runtime_error("skScreen: unknown game version");
}
float ratio = static_cast<float>(gameConfig.getWidth())/ static_cast<float>(gameConfig.getHeight());
replaceMemory(address, ratio);

OutputDebugString("skScreen: 3D screen ratio was set");
}

void BinaryFix::setUIRatio()
Expand Down Expand Up @@ -66,7 +66,7 @@ void BinaryFix::setUIRatio()
}

if (!addressX) {
throw std::runtime_error("set3DRatio: unknown game version");
throw std::runtime_error("skScreen: unknown game version");
}

addressY = addressX - 4;
Expand All @@ -83,6 +83,7 @@ void BinaryFix::setUIRatio()
float ratio = ratioWanted /ratio43 * 0.0020833334f; // 0.0020833334 is magic
replaceMemory(addressY, ratio);
}
OutputDebugString("skScreen: UI screen ratio was set");
}

void BinaryFix::removeResolutionLimit()
Expand Down Expand Up @@ -110,7 +111,7 @@ void BinaryFix::removeResolutionLimit()
}

if (!addressX) {
throw std::runtime_error("set3DRatio: unknown game version");
throw std::runtime_error("skScreen: unknown game version");
}

addressY = addressX+17;
Expand All @@ -119,6 +120,7 @@ void BinaryFix::removeResolutionLimit()
uint32_t resolution = 15360; //16k is 15360x864 we should be good for a few years :P
replaceMemory(addressX, resolution);
replaceMemory(addressY, resolution);
OutputDebugString("skScreen: removed resolution limit");
}

void BinaryFix::fixRadeon()
Expand All @@ -137,10 +139,12 @@ void BinaryFix::fixRadeon()
}

if (!address) {
throw std::runtime_error("set3DRatio: unknown game version");
throw std::runtime_error("skScreen: unknown game version");
}


char radeonFix[] = {'b', 'a', 'd', 'e', 'o', 'n', '\0'};
replaceMemory(address, radeonFix, sizeof(radeonFix));
}

OutputDebugString("skScreen: Applied Radeon fix");
}
2 changes: 1 addition & 1 deletion skScreen/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ void replaceMemory(DWORD address, uint32_t number)
char data[4];
memcpy(data, &number, 4);
replaceMemory(address, data, 4);
}
}
2 changes: 1 addition & 1 deletion skScreen/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
void replaceMemory(DWORD address, const char data[], uint32_t length);

void replaceMemory(DWORD address, float number);
void replaceMemory(DWORD address, uint32_t number);
void replaceMemory(DWORD address, uint32_t number);
8 changes: 0 additions & 8 deletions skScreen/gameConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@ GameConfig::GameConfig()
std::string equalSign;
std::string value;



ss >> key >> equalSign >> value;

std::stringstream ss2;
ss2 << key << equalSign << value;
OutputDebugString(ss.str().c_str());

configContainer.insert({ key, value });
}

Expand Down
11 changes: 0 additions & 11 deletions skScreen/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,6 @@

BOOL Initialize()
{
// getGameVersion();
// readGameResolution();
// readModuleConfiguration();

// set3Dratio();
// setUIRatio();

// removeResolutionLimit();
// fixRadeon();

// runInWindow();
GameVersion gameVersion;
GameConfig gameConfig;
BinaryFix binaryFix(gameVersion, gameConfig);
Expand Down

0 comments on commit 8204359

Please sign in to comment.