Jump to content

How to mod input.lua?


Recommended Posts

hello there,

     I did a simple hardcoded dirty hack on input.lua to make it shows xbox360 controller prompts on a linux machine

(Don't Starve recolonized a xbox controller as a generic controller on linux/mac), and I'm curious that is it possible to make this patch a mod? and how?

 

patches:

--- input.lua.bak 2014-06-28 10:13:51.897841317 +0800+++ input.lua 2014-06-28 11:38:07.049859004 +0800@@ -295,6 +295,10 @@if not (nil == intParam) thentext = string.format(text, intParam)end++ for key, rename in pairs(STRINGS.UI.CONTROLSSCREEN.GENERIC_CONTROLLER_RENAMES) do+ text = string.gsub(text, key, rename)+ endend--print ("Input Text:" .. tostring(text))return text;

 

--- strings.lua.bak 2014-06-28 10:12:30.809987420 +0800+++ strings.lua 2014-06-28 20:41:52.488622374 +0800@@ -2171,6 +2171,47 @@      CONTROLSSCREEN=     {+        -- my+        GENERIC_CONTROLLER_RENAMES=+        {+            -- a, b, x, y+            ["%(Button 0%)"] = "\127",+            ["%(Button 1%)"] = "\128",++            ["%(Button 2%)"] = "\129",+            ["%(Button 3%)"] = "\130",++            -- bumper+            ["%(Button 4%)"] = "\135",+            ["%(Button 5%)"] = "\138",++            --start, back+            ["%(Button 6%)"] = "\132",+            ["%(Button 7%)"] = "\131",++            -- Directional+            ["%(DPad %d Up%)"   ] = "\142",+            ["%(DPad %d Down%)" ] = "\139",+            ["%(DPad %d Left%)" ] = "\140",+            ["%(DPad %d Right%)"] = "\141",+            +            -- left thumb+            ["%(%-X Axis%)"] = "\145",+            ["%(%+X Axis%)"] = "\146",+            ["%(%-Y Axis%)"] = "\143",+            ["%(%+Y Axis%)"] = "\144",+            --+            -- triggers+            ["%(%+Z Axis%)"    ] = "\134",+            ["%(%+Z Rotation%)"] = "\137",+            -- right thumb+            ["%(%-X Rotation%)"] = "\149",+            ["%(%+X Rotation%)"] = "\150",+            ["%(%-Y Rotation%)"] = "\147",+            ["%(%+Y Rotation%)"] = "\148",+         },+        -- end here+                 -- Must match the Control enum in DontStarveInputHandler.h         -- Must match constants.lua CONTROLS_*         CONTROLS = {

 

post-338827-0-51679200-1403959112_thumb.

post-338827-0-96531800-1403959124_thumb.

Link to comment
Share on other sites

I'm curious that is it possible to make this patch a mod? and how?

It is. This should work:

ForcedXbox.zip

But Klei really should add proper control detection for non-Windows platforms. This was discussed in the bug tracker before. Currently it only assumes a controler is a Xbox 360 controller if its driver is the official Microsoft driver, which if of course a Windows-only solution.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
×
  • Create New...