mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-30 11:17:08 -05:00
Compare commits
6 commits
a221dbc00e
...
82c52e0d40
Author | SHA1 | Date | |
---|---|---|---|
|
82c52e0d40 | ||
|
d0eb881ebc | ||
|
ba5c527b18 | ||
|
e222313f22 | ||
|
4ce4fd972b | ||
|
93f423ae0e |
2 changed files with 24 additions and 1 deletions
|
@ -138,11 +138,34 @@ void* mainTrampolineAddr;
|
||||||
#include "gdTimestampMap.hpp"
|
#include "gdTimestampMap.hpp"
|
||||||
unsigned int gdTimestamp = 0;
|
unsigned int gdTimestamp = 0;
|
||||||
|
|
||||||
|
// In case the game is launched from a different directory through command line
|
||||||
|
// this function will set the current working directory to the game's directory
|
||||||
|
// to avoid the game crashing due to not being able to find the resources
|
||||||
|
static void fixCWD() {
|
||||||
|
std::array<WCHAR, MAX_PATH> cwd;
|
||||||
|
|
||||||
|
DWORD size = GetModuleFileNameW(NULL, cwd.data(), cwd.size());
|
||||||
|
if (size == cwd.size()) return;
|
||||||
|
|
||||||
|
int i;
|
||||||
|
for (i = (int)size - 1; i >= 0; i--) {
|
||||||
|
if (cwd[i] == '\\') {
|
||||||
|
cwd[i] = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (i < 0) return;
|
||||||
|
|
||||||
|
SetCurrentDirectoryW(cwd.data());
|
||||||
|
}
|
||||||
|
|
||||||
int WINAPI gdMainHook(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow) {
|
int WINAPI gdMainHook(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow) {
|
||||||
// MessageBoxA(NULL, "Hello from gdMainHook!", "Hi", 0);
|
// MessageBoxA(NULL, "Hello from gdMainHook!", "Hi", 0);
|
||||||
|
|
||||||
updateGeode();
|
updateGeode();
|
||||||
|
|
||||||
|
fixCWD();
|
||||||
|
|
||||||
if (versionToTimestamp(GEODE_STR(GEODE_GD_VERSION)) > gdTimestamp) {
|
if (versionToTimestamp(GEODE_STR(GEODE_GD_VERSION)) > gdTimestamp) {
|
||||||
console::messageBox(
|
console::messageBox(
|
||||||
"Unable to Load Geode!",
|
"Unable to Load Geode!",
|
||||||
|
|
|
@ -209,7 +209,7 @@ void SimpleTextArea::updateLinesNoWrap() {
|
||||||
|
|
||||||
void SimpleTextArea::updateLinesWordWrap(bool spaceWrap) {
|
void SimpleTextArea::updateLinesWordWrap(bool spaceWrap) {
|
||||||
this->charIteration([this, spaceWrap](CCLabelBMFont* line, const char c, const float top) {
|
this->charIteration([this, spaceWrap](CCLabelBMFont* line, const char c, const float top) {
|
||||||
static const std::string delimiters(spaceWrap ? " " : " `~!@#$%^&*()-_=+[{}];:'\",<.>/?\\|");
|
const std::string_view delimiters(spaceWrap ? " " : " `~!@#$%^&*()-_=+[{}];:'\",<.>/?\\|");
|
||||||
|
|
||||||
if (delimiters.find(c) == std::string_view::npos) {
|
if (delimiters.find(c) == std::string_view::npos) {
|
||||||
const std::string& text = line->getString();
|
const std::string& text = line->getString();
|
||||||
|
|
Loading…
Reference in a new issue