Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/OpenSHC/Util/Timing/Stopwatch/Constructor_Stopwatch.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "../Stopwatch.func.hpp"

namespace OpenSHC {
namespace Util {
namespace Timing {

// FUNCTION: STRONGHOLDCRUSADER 0x0046CEC0
Stopwatch* Stopwatch::Constructor_Stopwatch()
{
this->running_0x4 = FALSE;
this->duration_0x0 = 0;
return this;
}

}
}
}
16 changes: 16 additions & 0 deletions src/OpenSHC/Util/Timing/Stopwatch/start.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include "../Stopwatch.func.hpp"

namespace OpenSHC {
namespace Util {
namespace Timing {

// FUNCTION: STRONGHOLDCRUSADER 0x0046CED0
void Stopwatch::start()
{
this->startTime_0x8 = timeGetTime();
this->running_0x4 = TRUE;
}

}
}
}
20 changes: 20 additions & 0 deletions src/OpenSHC/Util/Timing/Stopwatch/stop.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include "../Stopwatch.func.hpp"

namespace OpenSHC {
namespace Util {
namespace Timing {

// FUNCTION: STRONGHOLDCRUSADER 0x0046CEF0
void Stopwatch::stop()
{
if (!this->running_0x4) {
return;
}
this->stopTime_0xc = timeGetTime();
this->running_0x4 = FALSE;
this->duration_0x0 = this->stopTime_0xc - this->startTime_0x8;
}

}
}
}
18 changes: 9 additions & 9 deletions src/OpenSHC/Util/WideCharMultiByteState.func.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@ namespace Util {
Address::SHC_3BB0A8C1_0x0046B080, &WideCharMultiByteState::wideCharToMultiByteComplete)
wideCharToMultiByteComplete;

MACRO_FUNCTION_RESOLVER(void (WideCharMultiByteState::*)(LPWSTR, LPCSTR), false,
MACRO_FUNCTION_RESOLVER(int (WideCharMultiByteState::*)(LPWSTR, LPCSTR), false,
Address::SHC_3BB0A8C1_0x0046B0D0, &WideCharMultiByteState::multiByteToWideCharacter)
multiByteToWideCharacter;

MACRO_FUNCTION_RESOLVER(int (WideCharMultiByteState::*)(LPSTR, LPWSTR, int), false,
Address::SHC_3BB0A8C1_0x0046B110, &WideCharMultiByteState::wideCharToMultiByteWithSize)
wideCharToMultiByteWithSize;

MACRO_FUNCTION_RESOLVER(void (WideCharMultiByteState::*)(LPWSTR, LPCSTR, int), false,
Address::SHC_3BB0A8C1_0x0046B140, &WideCharMultiByteState::multiByteToWideCharThunk)
multiByteToWideCharThunk;
MACRO_FUNCTION_RESOLVER(int (WideCharMultiByteState::*)(LPWSTR, LPCSTR, int), false,
Address::SHC_3BB0A8C1_0x0046B140, &WideCharMultiByteState::multiByteToWideCharWithSize)
multiByteToWideCharWithSize;

MACRO_FUNCTION_RESOLVER(char (WideCharMultiByteState::*)(WCHAR), false, Address::SHC_3BB0A8C1_0x0046B170,
&WideCharMultiByteState::wideCharToByteUnk)
wideCharToByteUnk;
&WideCharMultiByteState::singleWideCharToMultiByte)
singleWideCharToMultiByte;

MACRO_FUNCTION_RESOLVER(void (WideCharMultiByteState::*)(char const), false, Address::SHC_3BB0A8C1_0x0046B1B0,
&WideCharMultiByteState::multiByteToWideCharThunk2)
multiByteToWideCharThunk2;
MACRO_FUNCTION_RESOLVER(WCHAR (WideCharMultiByteState::*)(char), false, Address::SHC_3BB0A8C1_0x0046B1B0,
&WideCharMultiByteState::singleMultiByteToWideChar)
singleMultiByteToWideChar;

} // namespace WideCharMultiByteState_Func
} // namespace Util
Expand Down
8 changes: 4 additions & 4 deletions src/OpenSHC/Util/WideCharMultiByteState.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ namespace Util {

int wideCharToMultiByteComplete(LPSTR charOut, LPCWSTR wideCharIn);

void multiByteToWideCharacter(LPWSTR param_1, LPCSTR param_2);
int multiByteToWideCharacter(LPWSTR lpWideCharStr, LPCSTR lpMultiByteStr);

int wideCharToMultiByteWithSize(LPSTR lpMultiByteStr, LPWSTR lpWideCharStr, int numOfSymbols);

void multiByteToWideCharThunk(LPWSTR param_1, LPCSTR param_2, int param_3);
int multiByteToWideCharWithSize(LPWSTR lpWideCharStr, LPCSTR lpMultiByteStr, int numberOfSymbols);

char wideCharToByteUnk(WCHAR wideChar);
char singleWideCharToMultiByte(WCHAR wideChar);

void multiByteToWideCharThunk2(char const param_1);
WCHAR singleMultiByteToWideChar(char character);
};

static_assert_cpp98_obj(sizeof(WideCharMultiByteState) == 1, WideCharMultiByteState);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include "../WideCharMultiByteState.func.hpp"

#include "OpenSHC/Globals/DAT_TextManagerObject.hpp"

namespace OpenSHC {
namespace Util {

// FUNCTION: STRONGHOLDCRUSADER 0x0046B140
int WideCharMultiByteState::multiByteToWideCharWithSize(
LPWSTR lpWideCharStr, LPCSTR lpMultiByteStr, int numberOfSymbols)
{
int numberOfCharsWritten = MultiByteToWideChar(DAT_TextManagerObject::instance.codePage, MB_PRECOMPOSED,
lpMultiByteStr, numberOfSymbols, lpWideCharStr, numberOfSymbols);
lpWideCharStr[numberOfSymbols] = L'\0';
return numberOfCharsWritten;
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "../WideCharMultiByteState.func.hpp"

#include "OpenSHC/Globals/DAT_TextManagerObject.hpp"

namespace OpenSHC {
namespace Util {

// FUNCTION: STRONGHOLDCRUSADER 0x0046B0D0
int WideCharMultiByteState::multiByteToWideCharacter(LPWSTR lpWideCharStr, LPCSTR lpMultiByteStr)
{
int const numberOfBytes = strlen(lpMultiByteStr) + 1; // includes null terminator
return MultiByteToWideChar(DAT_TextManagerObject::instance.codePage, MB_PRECOMPOSED, lpMultiByteStr,
numberOfBytes, lpWideCharStr, numberOfBytes);
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include "../WideCharMultiByteState.func.hpp"

namespace OpenSHC {
namespace Util {

// FUNCTION: STRONGHOLDCRUSADER 0x0046B1B0
WCHAR WideCharMultiByteState::singleMultiByteToWideChar(char character)
{
WCHAR buffer[10];
MACRO_CALL_MEMBER(OpenSHC::Util::WideCharMultiByteState_Func::multiByteToWideCharWithSize, this)(
buffer, &character, 1);
return buffer[0];
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include "../WideCharMultiByteState.func.hpp"

namespace OpenSHC {
namespace Util {

// FUNCTION: STRONGHOLDCRUSADER 0x0046B170
char WideCharMultiByteState::singleWideCharToMultiByte(WCHAR wideChar)
{
char _byteBuffer[12];
MACRO_CALL_MEMBER(OpenSHC::Util::WideCharMultiByteState_Func::wideCharToMultiByteWithSize, this)(
_byteBuffer, &wideChar, 1);
return _byteBuffer[0];
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "../WideCharMultiByteState.func.hpp"

#include "OpenSHC/Globals/DAT_TextManagerObject.hpp"

namespace OpenSHC {
namespace Util {

// FUNCTION: STRONGHOLDCRUSADER 0x0046B080
int WideCharMultiByteState::wideCharToMultiByteComplete(LPSTR charOut, LPCWSTR wideCharIn)
{
int numberOfWideChars = wcslen(wideCharIn) + 1; // +1 for null terminator
return WideCharToMultiByte(DAT_TextManagerObject::instance.codePage, NULL, wideCharIn, numberOfWideChars,
charOut, numberOfWideChars, NULL, NULL);
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include "../WideCharMultiByteState.func.hpp"

#include "OpenSHC/Globals/DAT_TextManagerObject.hpp"

namespace OpenSHC {
namespace Util {

// FUNCTION: STRONGHOLDCRUSADER 0x0046B110
int WideCharMultiByteState::wideCharToMultiByteWithSize(
LPSTR lpMultiByteStr, LPWSTR lpWideCharStr, int numOfSymbols)
{
int const _numOfBytesWritten = WideCharToMultiByte(DAT_TextManagerObject::instance.codePage, NULL,
lpWideCharStr, numOfSymbols, lpMultiByteStr, numOfSymbols, NULL, NULL);
lpMultiByteStr[numOfSymbols] = '\0';
return _numOfBytesWritten;
}

}
}
18 changes: 9 additions & 9 deletions status/addresses-SHC-3BB0A8C1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20729,17 +20729,17 @@ SHC_3BB0A8C1_0x0046AE80 | 100.0% | Reimplemented

SHC_3BB0A8C1_0x0046AEC0 | 100.0% | Reimplemented

SHC_3BB0A8C1_0x0046B080 | 0.0% | Pending
SHC_3BB0A8C1_0x0046B080 | 100.0% | Reimplemented

SHC_3BB0A8C1_0x0046B0D0 | 0.0% | Pending
SHC_3BB0A8C1_0x0046B0D0 | 100.0% | Reimplemented

SHC_3BB0A8C1_0x0046B110 | 0.0% | Pending
SHC_3BB0A8C1_0x0046B110 | 100.0% | Reimplemented

SHC_3BB0A8C1_0x0046B140 | 0.0% | Pending
SHC_3BB0A8C1_0x0046B140 | 100.0% | Reimplemented

SHC_3BB0A8C1_0x0046B170 | 0.0% | Pending
SHC_3BB0A8C1_0x0046B170 | 100.0% | Reimplemented

SHC_3BB0A8C1_0x0046B1B0 | 0.0% | Pending
SHC_3BB0A8C1_0x0046B1B0 | 100.0% | Reimplemented

SHC_3BB0A8C1_0x0046B1F0 | 0.0% | Pending

Expand Down Expand Up @@ -20967,11 +20967,11 @@ SHC_3BB0A8C1_0x0046CEAC | 0.0% | Pending

SHC_3BB0A8C1_0x0046CEB0 | 0.0% | Pending

SHC_3BB0A8C1_0x0046CEC0 | 0.0% | Pending
SHC_3BB0A8C1_0x0046CEC0 | 100.0% | Reimplemented

SHC_3BB0A8C1_0x0046CED0 | 0.0% | Pending
SHC_3BB0A8C1_0x0046CED0 | 100.0% | Reimplemented

SHC_3BB0A8C1_0x0046CEF0 | 0.0% | Pending
SHC_3BB0A8C1_0x0046CEF0 | 100.0% | Reimplemented

SHC_3BB0A8C1_0x0046CF10 | 0.0% | Pending

Expand Down