Skip to content

Instantly share code, notes, and snippets.

@danger89 danger89/patch.diff
Last active Oct 29, 2016

Embed
What would you like to do?
[PATCH] Fixing cursor reset issue #539
Index: binaries/data/mods/mod/art/textures/cursors/test.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: binaries/data/mods/mod/art/textures/cursors/test.png
===================================================================
--- binaries/data/mods/mod/art/textures/cursors/test.png (revision 18887)
+++ binaries/data/mods/mod/art/textures/cursors/test.png (nonexistent)
Property changes on: binaries/data/mods/mod/art/textures/cursors/test.png
___________________________________________________________________
Deleted: svn:mime-type
## -1 +0,0 ##
-application/octet-stream
\ No newline at end of property
Index: binaries/data/mods/mod/art/textures/cursors/test.txt
===================================================================
--- binaries/data/mods/mod/art/textures/cursors/test.txt (revision 18887)
+++ binaries/data/mods/mod/art/textures/cursors/test.txt (nonexistent)
@@ -1 +0,0 @@
-1 1
Index: binaries/data/mods/public/art/textures/cursors/arrow-default.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: binaries/data/mods/public/art/textures/cursors/arrow-default.png
===================================================================
--- binaries/data/mods/public/art/textures/cursors/arrow-default.png (revision 18887)
+++ binaries/data/mods/public/art/textures/cursors/arrow-default.png (nonexistent)
Property changes on: binaries/data/mods/public/art/textures/cursors/arrow-default.png
___________________________________________________________________
Deleted: svn:mime-type
## -1 +0,0 ##
-application/octet-stream
\ No newline at end of property
Index: binaries/data/mods/public/art/textures/cursors/arrow-default.txt
===================================================================
--- binaries/data/mods/public/art/textures/cursors/arrow-default.txt (revision 18887)
+++ binaries/data/mods/public/art/textures/cursors/arrow-default.txt (nonexistent)
@@ -1 +0,0 @@
-1 1
Index: binaries/data/mods/public/art/textures/cursors/default.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Index: binaries/data/mods/public/art/textures/cursors/default.png
===================================================================
--- binaries/data/mods/public/art/textures/cursors/default.png (nonexistent)
+++ binaries/data/mods/public/art/textures/cursors/default.png (working copy)
Property changes on: binaries/data/mods/public/art/textures/cursors/default.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+image/png
\ No newline at end of property
Index: binaries/data/mods/public/art/textures/cursors/default.txt
===================================================================
--- binaries/data/mods/public/art/textures/cursors/default.txt (nonexistent)
+++ binaries/data/mods/public/art/textures/cursors/default.txt (working copy)
@@ -0,0 +1 @@
+1 1
Index: binaries/data/mods/public/gui/common/functions_utility_error.js
===================================================================
--- binaries/data/mods/public/gui/common/functions_utility_error.js (revision 18887)
+++ binaries/data/mods/public/gui/common/functions_utility_error.js (working copy)
@@ -25,5 +25,5 @@
}
// Reset cursor
- Engine.SetCursor("arrow-default");
+ Engine.ResetCursor();
}
Index: binaries/data/mods/public/gui/credits/texts/programming.json
===================================================================
--- binaries/data/mods/public/gui/credits/texts/programming.json (revision 18887)
+++ binaries/data/mods/public/gui/credits/texts/programming.json (working copy)
@@ -52,6 +52,7 @@
{"nick": "dan", "name": "Dan Strandberg"},
{"name": "Daniel Trevitz"},
{"nick": "DanCar", "name": "Daniel Cardenas"},
+ {"nick": "danger89", "name": "Melroy van den Berg"},
{"nick": "Dave", "name": "David Protasowski"},
{"nick": "dax", "name": "Dacian Fiordean"},
{"nick": "deebee", "name": "Deepak Anthony"},
Index: binaries/data/mods/public/gui/loading/loading.js
===================================================================
--- binaries/data/mods/public/gui/loading/loading.js (revision 18887)
+++ binaries/data/mods/public/gui/loading/loading.js (working copy)
@@ -104,5 +104,5 @@
Engine.SwitchGuiPage("page_session.xml", g_Data);
// Restore default cursor.
- Engine.SetCursor("arrow-default");
+ Engine.ResetCursor();
}
Index: binaries/data/mods/public/gui/session/input.js
===================================================================
--- binaries/data/mods/public/gui/session/input.js (revision 18887)
+++ binaries/data/mods/public/gui/session/input.js (working copy)
@@ -79,7 +79,7 @@
}
if (!cursorSet)
- Engine.SetCursor("arrow-default");
+ Engine.ResetCursor();
if (!tooltipSet)
informationTooltip.hidden = true;
Index: source/gui/GUIManager.cpp
===================================================================
--- source/gui/GUIManager.cpp (revision 18887)
+++ source/gui/GUIManager.cpp (working copy)
@@ -26,6 +26,7 @@
#include "ps/CLogger.h"
#include "ps/Profile.h"
#include "ps/XML/Xeromyces.h"
+#include "ps/GameSetup/Config.h"
#include "scriptinterface/ScriptInterface.h"
#include "scriptinterface/ScriptRuntime.h"
@@ -97,6 +98,9 @@
m_PageStack.back().name = pageName;
m_PageStack.back().initData = initData;
LoadPage(m_PageStack.back());
+
+ // Reset cursor to default cursor icon
+ ResetCursor();
}
void CGUIManager::PopPage()
@@ -299,6 +303,13 @@
return INFO::OK;
}
+
+void CGUIManager::ResetCursor()
+{
+ // Reset cursor to default
+ g_CursorName = L"default";
+}
+
std::string CGUIManager::GetSavedGameData()
{
shared_ptr<ScriptInterface> scriptInterface = top()->GetScriptInterface();
Index: source/gui/GUIManager.h
===================================================================
--- source/gui/GUIManager.h (revision 18887)
+++ source/gui/GUIManager.h (working copy)
@@ -92,6 +92,11 @@
*/
Status ReloadChangedFile(const VfsPath& path);
+ /**
+ * Resets the default cursor icon
+ */
+ void ResetCursor();
+
/**
* Called when we should reload all pages (e.g. translation hotloading update).
*/
Index: source/gui/scripting/ScriptFunctions.cpp
===================================================================
--- source/gui/scripting/ScriptFunctions.cpp (revision 18887)
+++ source/gui/scripting/ScriptFunctions.cpp (working copy)
@@ -113,6 +113,11 @@
g_GUI->PopPageCB(pCxPrivate->pScriptInterface->WriteStructuredClone(args));
}
+void ResetCursor(ScriptInterface::CxPrivate* UNUSED(pCxPrivate))
+{
+ g_GUI->ResetCursor();
+}
+
JS::Value GuiInterfaceCall(ScriptInterface::CxPrivate* pCxPrivate, const std::wstring& name, JS::HandleValue data)
{
if (!g_Game)
@@ -1016,6 +1021,7 @@
scriptInterface.RegisterFunction<void, &PopGuiPage>("PopGuiPage");
scriptInterface.RegisterFunction<void, JS::HandleValue, &PopGuiPageCB>("PopGuiPageCB");
scriptInterface.RegisterFunction<JS::Value, CStr, &GetGUIObjectByName>("GetGUIObjectByName");
+ scriptInterface.RegisterFunction<void, &ResetCursor>("ResetCursor");
// Simulation<->GUI interface functions:
scriptInterface.RegisterFunction<JS::Value, std::wstring, JS::HandleValue, &GuiInterfaceCall>("GuiInterfaceCall");
Index: source/ps/GameSetup/Config.cpp
===================================================================
--- source/ps/GameSetup/Config.cpp (revision 18887)
+++ source/ps/GameSetup/Config.cpp (working copy)
@@ -27,7 +27,7 @@
// (these variables are documented in the header.)
-CStrW g_CursorName = L"test";
+CStrW g_CursorName = L"default";
bool g_NoGLS3TC = false;
bool g_NoGLAutoMipmap = false;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.