forked from Mupen64-Rewrite/SM64LuaRedux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
InputDirection_dev.lua
149 lines (127 loc) · 4.11 KB
/
InputDirection_dev.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
-- Input Direction Lua Script v3.5
-- Author: MKDasher
-- Hacker: Eddio0141
-- Special thanks to Pannenkoek2012 and Peter Fedak for angle calculation support.
-- Also thanks to MKDasher to making the code very clean
-- Other contributors:
-- Madghostek, Xander, galoomba, ShadoXFM, Lemon, Manama, tjk
function folder(thisFileName)
local str = debug.getinfo(2, 'S').source:sub(2)
return (str:match('^.*/(.*).lua$') or str):sub(1, -(thisFileName):len() - 1)
end
PATH = debug.getinfo(1).source:sub(2):match("(.*\\)") .. "\\InputDirection_dev\\"
CURRENT_PATH = debug.getinfo(1).source:sub(2):match("(.*\\)") .. "\\"
dofile(CURRENT_PATH .. "mupen-lua-ugui.lua")
dofile(CURRENT_PATH .. "nineslice.lua")
dofile(PATH .. "Drawing.lua")
Drawing.resizeScreen()
dofile(PATH .. "Memory.lua")
dofile(PATH .. "Settings.lua")
dofile(PATH .. "Joypad.lua")
dofile(PATH .. "Angles.lua")
dofile(PATH .. "Engine.lua")
dofile(PATH .. "Buttons.lua")
dofile(PATH .. "Input.lua")
dofile(PATH .. "Program.lua")
dofile(PATH .. "MoreMaths.lua")
dofile(PATH .. "Actions.lua")
dofile(PATH .. "Swimming.lua")
dofile(PATH .. "RNGToIndex.lua")
dofile(PATH .. "IndexToRNG.lua")
dofile(PATH .. "recordghost.lua")
Settings.ShowEffectiveAngles = false -- show angles floored to the nearest multiple of 16
local tabs = {
"TAS",
"Settings"
}
local tab_index = 1
ustyle = {}
Program.initFrame()
Memory.UpdatePrevPos()
function main()
Program.initFrame()
Program.main()
Program.rngSetter()
Joypad.send()
Swimming.swim("A")
if recording_ghost then
Ghost.main()
end
end
function drawing()
section_name_path = folder('InputDirection_dev.lua') .. 'res\\' .. Settings.VisualStyles[Settings.VisualStyleIndex]
if not ustyles[section_name_path .. '.ustyles'] then
ustyles[section_name_path .. '.ustyles'] = parse_ustyles(section_name_path .. '.ustyles')
end
ustyle = ustyles[section_name_path .. '.ustyles']
for key, _ in pairs(Mupen_lua_ugui.stylers.windows_10.raised_frame_text_colors) do
Mupen_lua_ugui.stylers.windows_10.raised_frame_text_colors[key] = ustyle.raised_frame_text_colors[key]
end
for key, _ in pairs(Mupen_lua_ugui.stylers.windows_10.edit_frame_text_colors) do
Mupen_lua_ugui.stylers.windows_10.edit_frame_text_colors[key] = ustyle.edit_frame_text_colors[key]
end
local keys = input.get()
Mupen_lua_ugui.begin_frame(BreitbandGraphics.renderers.d2d, Mupen_lua_ugui.stylers.windows_10, {
pointer = {
position = {
x = keys.xmouse,
y = keys.ymouse,
},
is_primary_down = keys.leftclick,
},
keyboard = {
held_keys = keys,
},
})
Memory.Refresh()
BreitbandGraphics.renderers.d2d.fill_rectangle({
x = Drawing.Screen.Width,
y = 0,
width = Drawing.Screen.Width + Drawing.WIDTH_OFFSET,
height = Drawing.Screen.Height - 20
}, ustyles[section_name_path .. '.ustyles'].background_color)
if tab_index == 1 then
Drawing.paint()
Input.update()
elseif tab_index == 2 then
Settings.VisualStyleIndex = Mupen_lua_ugui.combobox({
uid = 12345678,
is_enabled = true,
rectangle = {
x = Drawing.Screen.Width + 5,
y = 5,
width = 150,
height = 23,
},
items = Settings.VisualStyles,
selected_index = Settings.VisualStyleIndex,
})
else
print('what')
end
tab_index = Mupen_lua_ugui.carrousel_button({
uid = 420,
is_enabled = true,
rectangle = {
x = Drawing.Screen.Width + 5,
y = 555,
width = Drawing.WIDTH_OFFSET - 10,
height = 23,
},
items = tabs,
selected_index = tab_index,
})
Mupen_lua_ugui.end_frame()
end
function close()
Drawing.UnResizeScreen()
end
emu.atinput(main)
emu.atupdatescreen(drawing)
emu.atstop(close)
if emu.atloadstate then
emu.atloadstate(drawing, false)
emu.atreset(Drawing.resizeScreen, false)
else
print("update ur mupen")
end