Main > Driving & Racing Cabinets
Sega Model 2 UI
gareth_iowc:
Finally a widescreen solution :)
I see the program requires some scripts for example -
daytonas.lua
--- Code: ---require("model2")
function Init()
end
function Frame()
local gameState = I960_ReadByte(0x5010A4)
if gameState==0x16
or gameState==0x03
or gameState==0x04
or gameState==0x05
or gameState==0x06
or gameState==0x07
then
Model2_SetStretchBLow(1)
Model2_SetWideScreen(1)
else
Model2_SetStretchBLow(0)
Model2_SetWideScreen(0)
end
end
--- End code ---
but I'm already using a script called daytonas.lua written by sailorsat that grabs the lamp and ffb data -
daytonas.lua
--- Code: ---require("model2"); -- Import model2 machine globals
function Init()
Patch_SpecialInputs();
Patch_LampOutputs();
end
function Patch_SpecialInputs()
-- first, disable old read
Romset_PatchDWord(0, 0x1E504, 0x5CA01E00); -- MOV g4,0x00 (NOOP?)
-- now jump to our patched read
Romset_PatchDWord(0, 0x1E508, 0x090219F8); -- CALL 0x0003FF00
-- read io port
Romset_PatchDWord(0, 0x3FF00, 0x80A03000);
Romset_PatchDWord(0, 0x3FF04, 0x01C00012); -- LDOB g4,0x01C00012
-- read patched mask
Romset_PatchDWord(0, 0x3FF08, 0x80B83000);
Romset_PatchDWord(0, 0x3FF0C, 0x00500820); -- LDOB g7,0x00500820
-- and em
Romset_PatchDWord(0, 0x3FF10, 0x58A50097); -- AND g4,g4,g7
-- restore old mask
Romset_PatchDWord(0, 0x3FF14, 0x8CB800FF); -- LDA g7,0xff
-- return
Romset_PatchDWord(0, 0x3FF18, 0x0A000000); -- RET
end
function Patch_LampOutputs()
-- reroute 0x01C0001E to 0x00500824
for offset = 0x00000000, 0x0003FFFF, 4 do
if Romset_ReadDWord(0, offset) == 0x01C0001E then
Romset_PatchDWord(0, offset, 0x00500824);
local opcode = offset - 1;
if Romset_ReadByte(0, opcode) == 0x80 then
Romset_PatchByte(0, opcode, 0x90) -- replace LDOB with LD
end
if Romset_ReadByte(0, opcode) == 0x82 then
Romset_PatchByte(0, opcode, 0x92) -- replace STOB with ST
end
end
end
end
function PostDraw()
if I960_ReadByte(RAMBASE + 0x00000820) == 0x00 then
I960_WriteByte(RAMBASE + 0x00000820, 0xFF);
end
-- 0xFF = normal
-- 0xFD = force beginner
-- 0xFB = force advanced
-- 0xF9 = force expert
-- 0xF7 = emergency/remote start
-- 0x7F = ex.start; found in schematics but don't yet know what it does
-- 0x3E = DIK_F4
-- 0x3E = DIK_F5
local data = 0xFF;
data = XOR(SHL(Input_IsKeyPressed(0x3E), 0x07), data); -- F4 for ex.start
data = XOR(SHL(Input_IsKeyPressed(0x3F), 0x03), data); -- F5 for emergency/remote start
I960_WriteByte(RAMBASE + 0x00000820, data);
Video_DrawText(0,0,HEX8(I960_ReadByte(0x00500824)),0xFFFFFF);
end
--- End code ---
I know very little about scripting and was wondering if the two can be combined?
Nuexzz:
I think something like this should work.
--- Code: ---require("model2"); -- Import model2 machine globals
function Frame()
local gameState = I960_ReadByte(0x5010A4)
if gameState==0x16
or gameState==0x03
or gameState==0x04
or gameState==0x05
or gameState==0x06
or gameState==0x07
then
Model2_SetStretchBLow(1)
Model2_SetWideScreen(1)
else
Model2_SetStretchBLow(0)
Model2_SetWideScreen(0)
end
end
function Init()
Patch_SpecialInputs();
Patch_LampOutputs();
end
function Patch_SpecialInputs()
-- first, disable old read
Romset_PatchDWord(0, 0x1E504, 0x5CA01E00); -- MOV g4,0x00 (NOOP?)
-- now jump to our patched read
Romset_PatchDWord(0, 0x1E508, 0x090219F8); -- CALL 0x0003FF00
-- read io port
Romset_PatchDWord(0, 0x3FF00, 0x80A03000);
Romset_PatchDWord(0, 0x3FF04, 0x01C00012); -- LDOB g4,0x01C00012
-- read patched mask
Romset_PatchDWord(0, 0x3FF08, 0x80B83000);
Romset_PatchDWord(0, 0x3FF0C, 0x00500820); -- LDOB g7,0x00500820
-- and em
Romset_PatchDWord(0, 0x3FF10, 0x58A50097); -- AND g4,g4,g7
-- restore old mask
Romset_PatchDWord(0, 0x3FF14, 0x8CB800FF); -- LDA g7,0xff
-- return
Romset_PatchDWord(0, 0x3FF18, 0x0A000000); -- RET
end
function Patch_LampOutputs()
-- reroute 0x01C0001E to 0x00500824
for offset = 0x00000000, 0x0003FFFF, 4 do
if Romset_ReadDWord(0, offset) == 0x01C0001E then
Romset_PatchDWord(0, offset, 0x00500824);
local opcode = offset - 1;
if Romset_ReadByte(0, opcode) == 0x80 then
Romset_PatchByte(0, opcode, 0x90) -- replace LDOB with LD
end
if Romset_ReadByte(0, opcode) == 0x82 then
Romset_PatchByte(0, opcode, 0x92) -- replace STOB with ST
end
end
end
end
function PostDraw()
if I960_ReadByte(RAMBASE + 0x00000820) == 0x00 then
I960_WriteByte(RAMBASE + 0x00000820, 0xFF);
end
-- 0xFF = normal
-- 0xFD = force beginner
-- 0xFB = force advanced
-- 0xF9 = force expert
-- 0xF7 = emergency/remote start
-- 0x7F = ex.start; found in schematics but don't yet know what it does
-- 0x3E = DIK_F4
-- 0x3E = DIK_F5
local data = 0xFF;
data = XOR(SHL(Input_IsKeyPressed(0x3E), 0x07), data); -- F4 for ex.start
data = XOR(SHL(Input_IsKeyPressed(0x3F), 0x03), data); -- F5 for emergency/remote start
I960_WriteByte(RAMBASE + 0x00000820, data);
Video_DrawText(0,0,HEX8(I960_ReadByte(0x00500824)),0xFFFFFF);
end
--- End code ---
Titchgamer:
Regarding your virus issue guys...,
Your checker should have a exception list where you can set folders in your computer that the AV will ignore.
Bullguard users for instance I can tell you its under settimgs/av/tuning.
Once you have excluded a folder you can put anything you like in it without the AV deleting or quarantining it.
Nuexzz:
--- Quote from: gareth_iowc on September 28, 2020, 03:55:31 pm ---Finally a widescreen solution :)
I see the program requires some scripts for example -
daytonas.lua
--- Code: ---require("model2")
function Init()
end
function Frame()
local gameState = I960_ReadByte(0x5010A4)
if gameState==0x16
or gameState==0x03
or gameState==0x04
or gameState==0x05
or gameState==0x06
or gameState==0x07
then
Model2_SetStretchBLow(1)
Model2_SetWideScreen(1)
else
Model2_SetStretchBLow(0)
Model2_SetWideScreen(0)
end
end
--- End code ---
but I'm already using a script called daytonas.lua written by sailorsat that grabs the lamp and ffb data -
daytonas.lua
--- Code: ---require("model2"); -- Import model2 machine globals
function Init()
Patch_SpecialInputs();
Patch_LampOutputs();
end
function Patch_SpecialInputs()
-- first, disable old read
Romset_PatchDWord(0, 0x1E504, 0x5CA01E00); -- MOV g4,0x00 (NOOP?)
-- now jump to our patched read
Romset_PatchDWord(0, 0x1E508, 0x090219F8); -- CALL 0x0003FF00
-- read io port
Romset_PatchDWord(0, 0x3FF00, 0x80A03000);
Romset_PatchDWord(0, 0x3FF04, 0x01C00012); -- LDOB g4,0x01C00012
-- read patched mask
Romset_PatchDWord(0, 0x3FF08, 0x80B83000);
Romset_PatchDWord(0, 0x3FF0C, 0x00500820); -- LDOB g7,0x00500820
-- and em
Romset_PatchDWord(0, 0x3FF10, 0x58A50097); -- AND g4,g4,g7
-- restore old mask
Romset_PatchDWord(0, 0x3FF14, 0x8CB800FF); -- LDA g7,0xff
-- return
Romset_PatchDWord(0, 0x3FF18, 0x0A000000); -- RET
end
function Patch_LampOutputs()
-- reroute 0x01C0001E to 0x00500824
for offset = 0x00000000, 0x0003FFFF, 4 do
if Romset_ReadDWord(0, offset) == 0x01C0001E then
Romset_PatchDWord(0, offset, 0x00500824);
local opcode = offset - 1;
if Romset_ReadByte(0, opcode) == 0x80 then
Romset_PatchByte(0, opcode, 0x90) -- replace LDOB with LD
end
if Romset_ReadByte(0, opcode) == 0x82 then
Romset_PatchByte(0, opcode, 0x92) -- replace STOB with ST
end
end
end
end
function PostDraw()
if I960_ReadByte(RAMBASE + 0x00000820) == 0x00 then
I960_WriteByte(RAMBASE + 0x00000820, 0xFF);
end
-- 0xFF = normal
-- 0xFD = force beginner
-- 0xFB = force advanced
-- 0xF9 = force expert
-- 0xF7 = emergency/remote start
-- 0x7F = ex.start; found in schematics but don't yet know what it does
-- 0x3E = DIK_F4
-- 0x3E = DIK_F5
local data = 0xFF;
data = XOR(SHL(Input_IsKeyPressed(0x3E), 0x07), data); -- F4 for ex.start
data = XOR(SHL(Input_IsKeyPressed(0x3F), 0x03), data); -- F5 for emergency/remote start
I960_WriteByte(RAMBASE + 0x00000820, data);
Video_DrawText(0,0,HEX8(I960_ReadByte(0x00500824)),0xFFFFFF);
end
--- End code ---
I know very little about scripting and was wondering if the two can be combined?
--- End quote ---
I'm glad it works well for you :o
fablog:
Nuexzz thanks a lot for your work, I like it a lot. Do you know if it's possible to get the sound in 5.1?
Envoyé de mon LEX722 en utilisant Tapatalk
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version