Skip to content

Commit

Permalink
Merge pull request #116 from chinosk6/main
Browse files Browse the repository at this point in the history
修复育成故事未判断 TextBlockList 导致崩溃的问题
  • Loading branch information
chinosk6 authored Mar 6, 2023
2 parents 37a4fb9 + 8660d3b commit 6b5afd7
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 21 deletions.
12 changes: 10 additions & 2 deletions src/camera/camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,11 +507,19 @@ namespace UmaCamera {
void mouseMove(LONG moveX, LONG moveY, int mouseEventType) {
if (mouseEventType == 1) { // down
rMousePressFlg = true;
ShowCursor(false);
int fCount = 0;
while (ShowCursor(false) >= 0) {
if (fCount >= 5) break;
fCount++;
}
}
else if (mouseEventType == 2) { // up
rMousePressFlg = false;
ShowCursor(true);
int fCount = 0;
while (ShowCursor(true) < 0) {
if (fCount >= 5) break;
fCount++;
}
}
else if (mouseEventType == 3) { // move
std::thread([moveX, moveY]() {
Expand Down
45 changes: 26 additions & 19 deletions src/hook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -705,28 +705,32 @@ namespace
}).detach();
}

bool isLiveStart = false;
void* wndproc_orig = nullptr;

LRESULT wndproc_hook(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (uMsg == WM_INPUT)
{
RAWINPUT rawInput;
UINT size = sizeof(RAWINPUT);
if (GetRawInputData((HRAWINPUT)lParam, RID_INPUT, &rawInput, &size, sizeof(RAWINPUTHEADER)) == size)
{
if (rawInput.header.dwType == RIM_TYPEMOUSE)
if (isLiveStart) {
RAWINPUT rawInput;
UINT size = sizeof(RAWINPUT);
if (GetRawInputData((HRAWINPUT)lParam, RID_INPUT, &rawInput, &size, sizeof(RAWINPUTHEADER)) == size)
{
switch (rawInput.data.mouse.ulButtons) {
case 0: { // move
UmaCamera::mouseMove(rawInput.data.mouse.lLastX, rawInput.data.mouse.lLastY, 3);
}; break;
case 4: { // press
UmaCamera::mouseMove(0, 0, 1);
}; break;
case 8: { // release
UmaCamera::mouseMove(0, 0, 2);
}; break;
default: break;
if (rawInput.header.dwType == RIM_TYPEMOUSE)
{
switch (rawInput.data.mouse.ulButtons) {
case 0: { // move
UmaCamera::mouseMove(rawInput.data.mouse.lLastX, rawInput.data.mouse.lLastY, 3);
}; break;
case 4: { // press
UmaCamera::mouseMove(0, 0, 1);
}; break;
case 8: { // release
UmaCamera::mouseMove(0, 0, 2);
}; break;
default: break;
}
}
}
}
Expand Down Expand Up @@ -971,7 +975,12 @@ namespace
StoryTimelineBlockDataClass = il2cpp_symbols::get_class_from_instance(blockData);
StoryTimelineBlockDataClass_TextTrackField = il2cpp_class_get_field_from_name(StoryTimelineBlockDataClass, "TextTrack");
}


if (i >= localizedStoryData->TextBlockList.size()) {
printf("[ERROR] Exception occurred while loading story text in TextBlockList. storyId: %llu, block: %d\n", storyId, i);
printf("The text content may be changed by Cygames, and the localized content may not display properly. Please report to the project maintainer.\n");
return;
}
const auto& clip = localizedStoryData->TextBlockList[i];
if (!clip)
{
Expand Down Expand Up @@ -1444,8 +1453,6 @@ namespace
return pos;
}

bool isLiveStart = false;

void* Unity_get_fieldOfView_orig;
float Unity_get_fieldOfView_hook(void* _this) {
if (g_set_live_fov_as_global || (isLiveStart && g_live_free_camera)) {
Expand Down

0 comments on commit 6b5afd7

Please sign in to comment.