Merge branch 'master' into release
This commit is contained in:
commit
2577ccf503
|
@ -2,7 +2,7 @@
|
|||
/snes9xgit
|
||||
|
||||
svnrev.cs
|
||||
|
||||
.vs/**
|
||||
**/bin/**
|
||||
**/obj/**
|
||||
/output/**
|
||||
|
|
|
@ -0,0 +1,149 @@
|
|||
function round(num, numDecimalPlaces)
|
||||
local mult = 10^(numDecimalPlaces or 0)
|
||||
return math.floor(num * mult + 0.5) / mult
|
||||
end
|
||||
|
||||
function get_baseline()
|
||||
i = 100
|
||||
client.reboot_core()
|
||||
t = os.clock()
|
||||
|
||||
while i > 0 do
|
||||
emu.frameadvance()
|
||||
i = i - 1
|
||||
end
|
||||
baseline = os.clock() - t
|
||||
print('Baseline: ' .. round(baseline, 3) .. " secs")
|
||||
return baseline
|
||||
end
|
||||
|
||||
function test_mmf()
|
||||
i = 100
|
||||
client.reboot_core()
|
||||
t = os.clock()
|
||||
while i > 0 do
|
||||
emu.frameadvance()
|
||||
comm.mmfScreenshot()
|
||||
i = i - 1
|
||||
end
|
||||
print('Memory mapped files: ' .. round((os.clock() - t - baseline), 3) .. " secs")
|
||||
end
|
||||
|
||||
function test_http()
|
||||
print("Testing HTTP server")
|
||||
client.reboot_core()
|
||||
i = 100
|
||||
t = os.clock()
|
||||
|
||||
while i > 0 do
|
||||
emu.frameadvance()
|
||||
comm.httpTestGet()
|
||||
i = i - 1
|
||||
end
|
||||
print('HTTP get: ' .. round((os.clock() - t - baseline), 3) .. " secs")
|
||||
|
||||
client.reboot_core()
|
||||
i = 100
|
||||
t = os.clock()
|
||||
|
||||
while i > 0 do
|
||||
emu.frameadvance()
|
||||
comm.httpPostScreenshot()
|
||||
i = i - 1
|
||||
end
|
||||
print('HTTP post: ' .. round((os.clock() - t - baseline), 3) .. " secs")
|
||||
|
||||
end
|
||||
|
||||
function test_socket()
|
||||
|
||||
i = 100
|
||||
client.reboot_core()
|
||||
t = os.clock()
|
||||
while i > 0 do
|
||||
emu.frameadvance()
|
||||
comm.socketServerScreenShot()
|
||||
i = i - 1
|
||||
end
|
||||
print('Socket server: ' .. round((os.clock() - t - baseline), 3) .. " secs")
|
||||
end
|
||||
|
||||
function test_socketresponse()
|
||||
best_time = -100
|
||||
timeouts = {1, 2, 3, 4, 5, 10, 20, 25, 50, 100, 250, 500, 1000}
|
||||
comm.socketServerSetTimeout(1000)
|
||||
resp = comm.socketServerScreenShotResponse()
|
||||
for t, timeout in ipairs(timeouts) do
|
||||
comm.socketServerSetTimeout(timeout)
|
||||
client.reboot_core()
|
||||
print("Trying to find minimal timeout for Socket server")
|
||||
i = 100
|
||||
t = os.clock()
|
||||
while i > 0 do
|
||||
emu.frameadvance()
|
||||
resp = comm.socketServerScreenShotResponse()
|
||||
if resp ~= 'ack' then
|
||||
i = -100
|
||||
print(resp)
|
||||
print("Failed to a get a proper response")
|
||||
end
|
||||
i = i - 1
|
||||
end
|
||||
if i > -100 then
|
||||
print("Best timeout: " .. timeout .. " msecs")
|
||||
print("Best time: " .. round((os.clock() - t - baseline), 3) .. " secs")
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function test_http_response()
|
||||
err = false
|
||||
print("Testing HTTP server response")
|
||||
client.reboot_core()
|
||||
i = 100
|
||||
|
||||
while i > 0 do
|
||||
emu.frameadvance()
|
||||
resp = comm.httpTestGet()
|
||||
if resp ~= "<html><body><h1>hi!</h1></body></html>" then
|
||||
print("Failed to get correct HTTP get response")
|
||||
print(resp)
|
||||
i = 0
|
||||
err = true
|
||||
end
|
||||
i = i - 1
|
||||
end
|
||||
if not err then
|
||||
print("HTTP GET looks fine: No errors occurred")
|
||||
end
|
||||
|
||||
client.reboot_core()
|
||||
i = 100
|
||||
err = false
|
||||
while i > 0 do
|
||||
emu.frameadvance()
|
||||
resp = comm.httpPostScreenshot()
|
||||
if resp ~= "<html><body>OK</body></html>" then
|
||||
print("Failed to get correct HTTP post response")
|
||||
print(resp)
|
||||
i = 0
|
||||
err = true
|
||||
end
|
||||
i = i - 1
|
||||
end
|
||||
if not err then
|
||||
print("HTTP POST looks fine: No errors occurred")
|
||||
end
|
||||
end
|
||||
|
||||
baseline = get_baseline()
|
||||
test_socket()
|
||||
test_mmf()
|
||||
test_http()
|
||||
print("#####################")
|
||||
test_http_response()
|
||||
test_socketresponse()
|
||||
print()
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
print("##########################################################")
|
||||
getUrl = comm.httpGetGetUrl()
|
||||
print("GET URL: " .. getUrl)
|
||||
|
||||
postUrl = comm.httpGetPostUrl()
|
||||
print("POST URL: " .. postUrl)
|
||||
|
||||
print("\nChecking GET URL change")
|
||||
error = false
|
||||
comm.httpSetGetUrl('a')
|
||||
if (getUrl ~= comm.httpGetGetUrl()) then
|
||||
comm.httpSetGetUrl(getUrl)
|
||||
error = (getUrl ~= comm.httpGetGetUrl())
|
||||
else
|
||||
error = true
|
||||
end
|
||||
|
||||
if error == false then
|
||||
print("Get URL was successfully changed")
|
||||
else
|
||||
print("Error while changing Get URL")
|
||||
end
|
||||
|
||||
|
||||
print("\nChecking POST URL change")
|
||||
error = false
|
||||
comm.httpSetPostUrl('a')
|
||||
if (postUrl ~= comm.httpGetPostUrl()) then
|
||||
comm.httpSetPostUrl(postUrl)
|
||||
error = (postUrl ~= comm.httpGetPostUrl())
|
||||
else
|
||||
error = true
|
||||
end
|
||||
|
||||
if error == false then
|
||||
print("Post URL was successfully changed")
|
||||
else
|
||||
print("Error while changing Post URL")
|
||||
end
|
||||
|
||||
print("\nChecking GET request")
|
||||
getResponse = comm.httpGet("http://tasvideos.org/BizHawk.html")
|
||||
if string.find(getResponse, "Bizhawk") then
|
||||
print("GET seems to work")
|
||||
else
|
||||
print("Either the Bizhawk site is down or the GET does not work")
|
||||
end
|
||||
|
||||
print("\nChecking memory mapped filed")
|
||||
|
||||
size = comm.mmfScreenshot()
|
||||
if size > 0 then
|
||||
print("Memory mapped file was successfully written")
|
||||
else
|
||||
print("Failed to write memory mapped file")
|
||||
end
|
||||
|
||||
mmf_filename = comm.mmfGetFilename()
|
||||
print("MMF filename: " .. mmf_filename)
|
||||
comm.mmfSetFilename("deleteme.tmp")
|
||||
error = false
|
||||
if (mmf_filename ~= comm.mmfGetFilename()) then
|
||||
comm.mmfSetFilename(mmf_filename)
|
||||
error = (mmf_filename ~= comm.mmfGetFilename())
|
||||
else
|
||||
error = true
|
||||
end
|
||||
if error == false then
|
||||
print("MMF filename successfully changed")
|
||||
else
|
||||
print("MMF filename change failed")
|
||||
end
|
||||
|
||||
print("Writing to MMF")
|
||||
|
||||
message = "ABC"
|
||||
resp_n = tonumber(comm.mmfWrite(mmf_filename, message))
|
||||
if (resp_n ~= string.len(message)) then
|
||||
print("Failed to write to MMF")
|
||||
else
|
||||
resp = comm.mmfRead(mmf_filename, string.len(message))
|
||||
if (resp ~= message) then
|
||||
print("Failed to read from MMF")
|
||||
else
|
||||
print("MMF read and read OK")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
print("\nTests finished")
|
||||
print("Please run TestCommunication_All.lua with the supplied Python server for a more comprehensive test")
|
|
@ -755,7 +755,7 @@
|
|||
"Reset": "J1 B9, X1 Back",
|
||||
"Pause": "J1 B10, X1 Start"
|
||||
},
|
||||
"SMS Sports Pad Controller": {
|
||||
"SMS Sports Pad Controller": {
|
||||
"P1 Up": "UpArrow, J1 POV1U",
|
||||
"P1 Down": "DownArrow, J1 POV1D",
|
||||
"P1 Left": "LeftArrow, J1 POV1L",
|
||||
|
@ -771,6 +771,89 @@
|
|||
"P2 B1": "",
|
||||
"P2 B2": ""
|
||||
},
|
||||
"SMS Keyboard Controller": {
|
||||
"Key 1": "D1",
|
||||
"Key 2": "D2",
|
||||
"Key 3": "D3",
|
||||
"Key 4": "D4",
|
||||
"Key 5": "D5",
|
||||
"Key 6": "D6",
|
||||
"Key 7": "D7",
|
||||
"Key 8": "D8",
|
||||
"Key 9": "D9",
|
||||
"Key 0": "D0",
|
||||
"Key Minus": "Minus",
|
||||
"Key Caret": "Equals",
|
||||
"Key Yen": "Backspace",
|
||||
"Key Break": "Delete",
|
||||
|
||||
"Key Function": "Tab",
|
||||
"Key Q": "Q",
|
||||
"Key W": "W",
|
||||
"Key E": "E",
|
||||
"Key R": "R",
|
||||
"Key T": "T",
|
||||
"Key Y": "Y",
|
||||
"Key U": "U",
|
||||
"Key I": "I",
|
||||
"Key O": "O",
|
||||
"Key P": "P",
|
||||
"Key At": "LeftBracket",
|
||||
"Key Left Bracket": "RightBracket",
|
||||
"Key Return": "Return",
|
||||
"Key Up Arrow": "UpArrow",
|
||||
|
||||
"Key Control": "CapsLock",
|
||||
"Key A": "A",
|
||||
"Key S": "S",
|
||||
"Key D": "D",
|
||||
"Key F": "F",
|
||||
"Key G": "G",
|
||||
"Key H": "H",
|
||||
"Key J": "J",
|
||||
"Key K": "K",
|
||||
"Key L": "L",
|
||||
"Key Semicolon": "Semicolon",
|
||||
"Key Colon": "Apostrophe",
|
||||
"Key Right Bracket": "Backslash",
|
||||
"Key Left Arrow": "LeftArrow",
|
||||
"Key Right Arrow": "RightArrow",
|
||||
|
||||
"Key Shift": "LeftShift",
|
||||
"Key Z": "Z",
|
||||
"Key X": "X",
|
||||
"Key C": "C",
|
||||
"Key V": "V",
|
||||
"Key B": "B",
|
||||
"Key N": "N",
|
||||
"Key M": "M",
|
||||
"Key Comma": "Comma",
|
||||
"Key Period": "Period",
|
||||
"Key Slash": "Slash",
|
||||
"Key PI": "RightShift",
|
||||
"Key Down Arrow": "DownArrow",
|
||||
|
||||
"Key Graph": "PageUp",
|
||||
"Key Kana": "PageDown",
|
||||
"Key Space": "Space",
|
||||
"Key Home/Clear": "Home",
|
||||
"Key Insert/Delete": "Insert",
|
||||
|
||||
"P1 Up": "J1 POV1U, X1 DpadUp, X1 LStickUp",
|
||||
"P1 Down": "J1 POV1D, X1 DpadDown, X1 LStickDown",
|
||||
"P1 Left": "J1 POV1L, X1 DpadLeft, X1 LStickLeft",
|
||||
"P1 Right": "J1 POV1R, X1 DpadRight, X1 LStickRight",
|
||||
"P1 B1": "J1 B1, X1 X",
|
||||
"P1 B2": "J1 B2, X1 A",
|
||||
"Reset": "J1 B9, X1 Back",
|
||||
"Pause": "J1 B10, X1 Start",
|
||||
"P2 Up": "",
|
||||
"P2 Down": "",
|
||||
"P2 Left": "",
|
||||
"P2 Right": "",
|
||||
"P2 B1": "",
|
||||
"P2 B2": ""
|
||||
},
|
||||
"GG Controller": {
|
||||
"P1 Up": "UpArrow, J1 POV1U, X1 DpadUp, X1 LStickUp",
|
||||
"P1 Down": "DownArrow, J1 POV1D, X1 DpadDown, X1 LStickDown",
|
||||
|
@ -1615,23 +1698,23 @@
|
|||
"Deadzone": 0.0
|
||||
}
|
||||
},
|
||||
"SMS Sports Pad Controller": {
|
||||
"SMS Sports Pad Controller": {
|
||||
"P1 X": {
|
||||
"Value": "X1 LeftThumbX",
|
||||
"Mult": 1.0,
|
||||
"Deadzone": 0.1
|
||||
},
|
||||
"P1 Y": {
|
||||
"P1 Y": {
|
||||
"Value": "X1 LeftThumbY",
|
||||
"Mult": -1.0,
|
||||
"Deadzone": 0.1
|
||||
},
|
||||
"P2 X": {
|
||||
"P2 X": {
|
||||
"Value": "X2 LeftThumbX",
|
||||
"Mult": 1.0,
|
||||
"Deadzone": 0.1
|
||||
},
|
||||
"P2 Y": {
|
||||
"P2 Y": {
|
||||
"Value": "X2 LeftThumbY",
|
||||
"Mult": -1.0,
|
||||
"Deadzone": 0.1
|
||||
|
|
|
@ -273,6 +273,9 @@ sha1:3C72706AF5998133EC6BE703994C10466A094EAB Xing Ji Zheng Ba (China) (Unl) NE
|
|||
sha1:18DF013DB350787D0F3D83ADE33EA92B097BD54B Mahjan Samit Kabukicho Hen (Asia) (Unl) NES board=MAPPER146;PRG=64;CHR=64;WRAM=0;VRAM=0;PAD_V=1;PAD_H=0
|
||||
sha1:6AAA5521F91F101448E77C996C9802015578400C Dooly_Bravo_Land NES board=MAPPER002;PRG=256;CHR=0;WRAM=0;VRAM=8;PAD_V=0;PAD_H=1
|
||||
sha1:4EBC1ED9665C36913D0F05129E6A54787BAD3165 Dragon Ball 3 - Gokuu Den (Japan) (Rev 1) NES board=BANDAI-FCG-2;PRG=128;CHR=256;WRAM=0;VRAM=0;PAD_V=0;PAD_H=1
|
||||
sha1:5A6DFDD8A2D62EBE313A6FDB986C3585077BB348 Final Combat (Asia) (NTSC) (Unl) NES board=MAPPER139
|
||||
sha1:DFAF6D81280ADBEB2ADF3DAB38E536B0F2FDFC76 Final Combat (Asia) (PAL) (Unl) NES board=MAPPER139;system=NES-PAL
|
||||
sha1:433CEC30E71DCA31E32B8A44A0D534DBFE7039CA BoogerMan II (RexSoft) [!] NES board=UNIF_UNL-KOF97
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;-----------------------------------------------------------------------
|
||||
|
||||
|
@ -298,6 +301,8 @@ sha1:CEFEBA536DB507DBDEF8A538F9C332D7A75BF613 You Ling Xing Dong (Ch) NES boar
|
|||
sha1:DBFCC70CC2DEC7A889429ED542267F0F1BD967BF Ying Xiong Chuan Qi (Ch) NES board=MAPPER224
|
||||
sha1:FFB4706E49B826C6CDD12E502E8AE94FC9810B7F Monty no Doki Doki Daisassou (FDS Conversion) (Unl) [U][!] NES board=UNIF_UNL-LH32;WRAM=8;VRAM=8;PAD_H=1
|
||||
sha1:17473C223453D2D80FCB9DCFA317947287DC5C52 Xing He Zhan Shi (China) (Unl) NES board=WAIXINGMAPPER176
|
||||
sha1:B1C74236FD17FAB4AB9AA6AB28E38864C66D6255 Pocahontus (UNL) NES board=MAPPER182;PRG=256;CHR=256;WRAM=8;PAD_H=1
|
||||
sha1:5FA23F88432006DCF6874EA36E9E7DA8934427BE Super Donkey Kong (Unl) NES board=MAPPER182;PRG=128;CHR=128;WRAM=8;PAD_H=1
|
||||
|
||||
;wrong vram info
|
||||
sha1:32D71DD6C5A8D78A918FE1B9D6D6C4A570D9652D Oeka Kids Anpanman no Hiragana Daisuki (J) NES board=MAPPER096;VRAM=32
|
||||
|
|
|
@ -264,7 +264,7 @@ C0A9A2261EA7EF93BF8120F5328DEAEC Great Golf (J) SMS Sports;Golf FM Japan
|
|||
BE6EAC7CE416C86A818FF13B228B39C5 Great Tennis (J) SMS Sports;Tennis Japan
|
||||
382B627EFA06C958B8EC5C85E964BF10 Great Volleyball (UE) SMS Sports;Volleyball USA;Europe
|
||||
03D6E8450A74AC09E47AE9BF210CFE17 Great Volleyball (J) SMS Sports;Volleyball Japan
|
||||
B54989C58520516F4C10CE4E7A446725 Haja no Fuuin (J) SMS RPG SRAM=8192 Japan
|
||||
B54989C58520516F4C10CE4E7A446725 Haja no Fuuin (J) SMS RPG SRAM=8192;FM Japan
|
||||
3701CB59DFD137246D163462D18E8DD4 Hang-On & Astro Warrior (U) SMS USA
|
||||
84284C327B07C200C16F4E13B2E8DE79 Hang-On & Safari Hunt (U) SMS Light Gun;Arcade Phaser USA
|
||||
16D870BF1A5A23A9F2993D8786F5BC74 Hang-On & Safari Hunt (U) (Beta) SMS Light Gun;Arcade Phaser USA
|
||||
|
@ -564,7 +564,7 @@ E7F86C049E4BD8B26844FF62BD067D57 Wonder Boy III - The Dragon's Trap (UE) SMS Wo
|
|||
16BE61F4DE705CDD636D1FB1662E24DE Wonder Boy in Monster Land (UE) (Beta) SMS Wonder Boy Series;Arcade FM USA;Europe
|
||||
5837764C172C8C43C8C7B21F2144CF27 Wonder Boy in Monster World (E) SMS Wonder Boy Series Europe
|
||||
311AA03DCAB8EDCF9891397AC3297B72 Wonder Boy in Monster World (E) (Beta) SMS Wonder Boy Series Europe
|
||||
8883790D3B3D4FED9A845D63AA251786 Wonder Boy in Monster World (J) SMS Wonder Boy Series Japan
|
||||
8883790D3B3D4FED9A845D63AA251786 Wonder Boy in Monster World (J) SMS Wonder Boy Series FM Japan
|
||||
7E805AA51BFB5F206C950A32EBCDAB7C Wonder Boy (UE) SMS Wonder Boy Series USA;Europe
|
||||
A4E48850BF8799CFAC74B1D33F5900B5 Wonder Boy (JE) SMS Wonder Boy Series Europe;Japan
|
||||
C53091E60B5BD473142CA231DD96F6EB Wonsiin (K) SMS MSXMapper Korea
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<!--<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>-->
|
||||
<CodeAnalysisRuleSet Condition=" '$(OS)' == 'Windows_NT' ">MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
|
||||
<OutputPath>..\output\dll\</OutputPath>
|
||||
|
@ -17,7 +18,8 @@
|
|||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<!--<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>-->
|
||||
<CodeAnalysisRuleSet Condition=" '$(OS)' == 'Windows_NT' ">MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
|
@ -93,4 +95,4 @@
|
|||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
@ -23,7 +23,8 @@
|
|||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<!--<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>-->
|
||||
<CodeAnalysisRuleSet Condition=" '$(OS)' == 'Windows_NT' ">MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
|
||||
</PropertyGroup>
|
||||
|
@ -35,7 +36,8 @@
|
|||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<!--<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>-->
|
||||
<CodeAnalysisRuleSet Condition=" '$(OS)' == 'Windows_NT' ">MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
|
||||
</PropertyGroup>
|
||||
|
@ -182,6 +184,7 @@
|
|||
</Compile>
|
||||
<Compile Include="movie\bk2\StringLogs.cs" />
|
||||
<Compile Include="movie\import\PXMImport.cs" />
|
||||
<Compile Include="movie\tasproj\StateManagerDecay.cs" />
|
||||
<Compile Include="movie\tasproj\StateManagerState.cs" />
|
||||
<Compile Include="movie\tasproj\TasBranch.cs" />
|
||||
<Compile Include="movie\tasproj\TasMovie.History.cs" />
|
||||
|
@ -268,6 +271,7 @@
|
|||
<Compile Include="tools\Watch\SeparatorWatch.cs" />
|
||||
<Compile Include="tools\Watch\Watch.cs" />
|
||||
<Compile Include="tools\Watch\WatchList\WatchChangeCountComparer.cs" />
|
||||
<Compile Include="tools\Watch\WatchList\WatchDisplayTypeComparer.cs" />
|
||||
<Compile Include="tools\Watch\WatchList\WatchEqualityComparer.cs" />
|
||||
<Compile Include="tools\Watch\WatchList\WatchDomainComparer.cs" />
|
||||
<Compile Include="tools\Watch\WatchList\WatchAddressComparer.cs" />
|
||||
|
|
|
@ -112,11 +112,12 @@ namespace BizHawk.Client.Common
|
|||
case "SNES":
|
||||
return SystemInfo.SNES;
|
||||
case "GB":
|
||||
/*
|
||||
if ((Emulator as IGameboyCommon).IsCGBMode())
|
||||
{
|
||||
return SystemInfo.GBC;
|
||||
}
|
||||
|
||||
*/
|
||||
return SystemInfo.GB;
|
||||
case "A26":
|
||||
return SystemInfo.Atari2600;
|
||||
|
|
|
@ -336,6 +336,12 @@ namespace BizHawk.Client.Common
|
|||
name += "." + Global.Emulator.Attributes().CoreName;
|
||||
}
|
||||
|
||||
// Gambatte and GBHawk have incompatible savestates, store the name to keep them separate
|
||||
if (Global.Emulator.SystemId == "GB")
|
||||
{
|
||||
name += "." + Global.Emulator.Attributes().CoreName;
|
||||
}
|
||||
|
||||
if (Global.Emulator is Snes9x) // Keep snes9x savestate away from libsnes, we want to not be too tedious so bsnes names will just have the profile name not the core name
|
||||
{
|
||||
name += "." + Global.Emulator.Attributes().CoreName;
|
||||
|
|
|
@ -13,6 +13,7 @@ using BizHawk.Emulation.Cores.Computers.AppleII;
|
|||
using BizHawk.Emulation.Cores.Computers.Commodore64;
|
||||
using BizHawk.Emulation.Cores.Consoles.Sega.gpgx;
|
||||
using BizHawk.Emulation.Cores.Nintendo.Gameboy;
|
||||
using BizHawk.Emulation.Cores.Nintendo.GBHawk;
|
||||
using BizHawk.Emulation.Cores.Nintendo.SNES;
|
||||
using BizHawk.Emulation.Cores.PCEngine;
|
||||
using BizHawk.Emulation.Cores.Sega.Saturn;
|
||||
|
@ -935,10 +936,36 @@ namespace BizHawk.Client.Common
|
|||
break;
|
||||
|
||||
case "GB":
|
||||
case "GBC":
|
||||
if (!Global.Config.GB_AsSGB)
|
||||
{
|
||||
core = CoreInventory.Instance["GB", "Gambatte"];
|
||||
if (Global.Config.GB_UseGBHawk)
|
||||
{
|
||||
core = CoreInventory.Instance["GB", "GBHawk"];
|
||||
}
|
||||
else
|
||||
{
|
||||
core = CoreInventory.Instance["GB", "Gambatte"];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Global.Config.SGB_UseBsnes)
|
||||
{
|
||||
game.System = "SNES";
|
||||
game.AddOption("SGB");
|
||||
var snes = new LibsnesCore(game, rom.FileData, null, nextComm, GetCoreSettings<LibsnesCore>(), GetCoreSyncSettings<LibsnesCore>());
|
||||
nextEmulator = snes;
|
||||
}
|
||||
else
|
||||
{
|
||||
core = CoreInventory.Instance["SGB", "SameBoy"];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "GBC":
|
||||
if (!Global.Config.GB_AsSGB)
|
||||
{
|
||||
core = CoreInventory.Instance["GBC", "Gambatte"];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -960,7 +987,7 @@ namespace BizHawk.Client.Common
|
|||
nextEmulator = new A7800Hawk(nextComm, game, rom.RomData, gamedbpath, GetCoreSettings<A7800Hawk>(), GetCoreSyncSettings<A7800Hawk>());
|
||||
break;
|
||||
case "C64":
|
||||
var c64 = new C64(nextComm, Enumerable.Repeat(rom.RomData, 1), rom.GameInfo, GetCoreSettings<C64>(), GetCoreSyncSettings<C64>());
|
||||
var c64 = new C64(nextComm, Enumerable.Repeat(rom.FileData, 1), rom.GameInfo, GetCoreSettings<C64>(), GetCoreSyncSettings<C64>());
|
||||
nextEmulator = c64;
|
||||
break;
|
||||
case "GBA":
|
||||
|
|
|
@ -125,6 +125,7 @@ namespace BizHawk.Client.Common
|
|||
Bind("General", "Hard Reset"),
|
||||
Bind("General", "Quick Load", "P"),
|
||||
Bind("General", "Quick Save", "I"),
|
||||
Bind("General", "Autofire"),
|
||||
Bind("General", "Autohold"),
|
||||
Bind("General", "Clear Autohold"),
|
||||
Bind("General", "Screenshot", "F12"),
|
||||
|
@ -148,7 +149,6 @@ namespace BizHawk.Client.Common
|
|||
Bind("General", "Increase Speed", "Equals"),
|
||||
Bind("General", "Decrease Speed", "Minus"),
|
||||
Bind("General", "Reboot Core", "Ctrl+R"),
|
||||
Bind("General", "Autofire"),
|
||||
Bind("General", "Toggle Sound"),
|
||||
Bind("General", "Exit Program"),
|
||||
Bind("General", "Screen Raw to Clipboard", "Ctrl+C"),
|
||||
|
|
|
@ -557,6 +557,7 @@ namespace BizHawk.Client.Common
|
|||
public bool SNES_InSnes9x = true;
|
||||
public bool GBA_UsemGBA = true;
|
||||
public bool SGB_UseBsnes = false;
|
||||
public bool GB_UseGBHawk = false;
|
||||
public bool CoreForcingViaGameDB = true;
|
||||
public string LibretroCore;
|
||||
}
|
||||
|
|
|
@ -155,6 +155,8 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public string MoviesPathFragment => Global.Config.PathEntries["Global", "Movies"].Path;
|
||||
|
||||
public string MoviesBackupsPathFragment => Global.Config.PathEntries["Global", "Movie backups"].Path;
|
||||
|
||||
public string LuaPathFragment => Global.Config.PathEntries["Global", "Lua"].Path;
|
||||
|
||||
public string FirmwaresPathFragment => Global.Config.PathEntries["Global", "Firmware"].Path;
|
||||
|
|
|
@ -27,6 +27,32 @@ namespace BizHawk.Client.Common
|
|||
internal IController SourceAnd { get; set; }
|
||||
}
|
||||
|
||||
public class XorAdapter : IController
|
||||
{
|
||||
public ControllerDefinition Definition => Source.Definition;
|
||||
|
||||
public bool IsPressed(string button)
|
||||
{
|
||||
if (Source != null && SourceXor != null)
|
||||
{
|
||||
return Source.IsPressed(button) ^ SourceXor.IsPressed(button);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// pass floats solely from the original source
|
||||
// this works in the code because SourceOr is the autofire controller
|
||||
public float GetFloat(string name)
|
||||
{
|
||||
return Source.GetFloat(name);
|
||||
}
|
||||
|
||||
internal IController Source { get; set; }
|
||||
internal IController SourceXor { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class ORAdapter : IController
|
||||
{
|
||||
public ControllerDefinition Definition => Source.Definition;
|
||||
|
|
|
@ -16,6 +16,19 @@ namespace BizHawk.Client.Common.InputAdapterExtensions
|
|||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new IController that is in a state of a bitwise Xor of the source and target controllers
|
||||
/// </summary>
|
||||
public static IController Xor(this IController source, IController target)
|
||||
{
|
||||
return new XorAdapter
|
||||
{
|
||||
Source = source,
|
||||
SourceXor = target
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new IController that is in a state of a bitwise Or of the source and target controllers
|
||||
/// </summary>
|
||||
|
|
|
@ -16,84 +16,98 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public override string Name => "bit";
|
||||
|
||||
[LuaMethodExample("local uibitban = bit.band( 1000, 4 );")]
|
||||
[LuaMethod("band", "Bitwise AND of 'val' against 'amt'")]
|
||||
public static uint Band(uint val, uint amt)
|
||||
{
|
||||
return val & amt;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local uibitbno = bit.bnot( 1000 );")]
|
||||
[LuaMethod("bnot", "Bitwise NOT of 'val' against 'amt'")]
|
||||
public static uint Bnot(uint val)
|
||||
{
|
||||
return ~val;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local uibitbor = bit.bor( 1000, 4 );")]
|
||||
[LuaMethod("bor", "Bitwise OR of 'val' against 'amt'")]
|
||||
public static uint Bor(uint val, uint amt)
|
||||
{
|
||||
return val | amt;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local uibitbxo = bit.bxor( 1000, 4 );")]
|
||||
[LuaMethod("bxor", "Bitwise XOR of 'val' against 'amt'")]
|
||||
public static uint Bxor(uint val, uint amt)
|
||||
{
|
||||
return val ^ amt;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local uibitlsh = bit.lshift( 1000, 4 );")]
|
||||
[LuaMethod("lshift", "Logical shift left of 'val' by 'amt' bits")]
|
||||
public static uint Lshift(uint val, int amt)
|
||||
{
|
||||
return val << amt;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local uibitrol = bit.rol( 1000, 4 );")]
|
||||
[LuaMethod("rol", "Left rotate 'val' by 'amt' bits")]
|
||||
public static uint Rol(uint val, int amt)
|
||||
{
|
||||
return (val << amt) | (val >> (32 - amt));
|
||||
}
|
||||
|
||||
[LuaMethodExample("local uibitror = bit.ror( 1000, 4 );")]
|
||||
[LuaMethod("ror", "Right rotate 'val' by 'amt' bits")]
|
||||
public static uint Ror(uint val, int amt)
|
||||
{
|
||||
return (val >> amt) | (val << (32 - amt));
|
||||
}
|
||||
|
||||
[LuaMethodExample("local uibitrsh = bit.rshift( 1000, 4 );")]
|
||||
[LuaMethod("rshift", "Logical shift right of 'val' by 'amt' bits")]
|
||||
public static uint Rshift(uint val, int amt)
|
||||
{
|
||||
return (uint)(val >> amt);
|
||||
}
|
||||
|
||||
[LuaMethodExample("local inbitars = bit.arshift( -1000, 4 );")]
|
||||
[LuaMethod("arshift", "Arithmetic shift right of 'val' by 'amt' bits")]
|
||||
public static int Arshift(int val, int amt)
|
||||
{
|
||||
return val >> amt;
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( bit.check( -12345, 35 ) ) then\r\n\tconsole.log( \"Returns result of bit 'pos' being set in 'num'\" );\r\nend;")]
|
||||
[LuaMethod("check", "Returns result of bit 'pos' being set in 'num'")]
|
||||
public static bool Check(long num, int pos)
|
||||
{
|
||||
return (num & (1 << pos)) != 0;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local uibitset = bit.set( 25, 35 );")]
|
||||
[LuaMethod("set", "Sets the bit 'pos' in 'num'")]
|
||||
public static uint Set(uint num, int pos)
|
||||
{
|
||||
return (uint)(num | (uint)1 << pos);
|
||||
}
|
||||
|
||||
[LuaMethodExample("local lobitcle = bit.clear( 25, 35 );")]
|
||||
[LuaMethod("clear", "Clears the bit 'pos' in 'num'")]
|
||||
public static long Clear(uint num, int pos)
|
||||
{
|
||||
return num & ~(1 << pos);
|
||||
}
|
||||
|
||||
[LuaMethodExample("local usbitbyt = bit.byteswap_16( 100 );")]
|
||||
[LuaMethod("byteswap_16", "Byte swaps 'short', i.e. bit.byteswap_16(0xFF00) would return 0x00FF")]
|
||||
public static ushort Byteswap16(ushort val)
|
||||
{
|
||||
return (ushort)((val & 0xFFU) << 8 | (val & 0xFF00U) >> 8);
|
||||
}
|
||||
|
||||
[LuaMethodExample("local uibitbyt = bit.byteswap_32( 1000 );")]
|
||||
[LuaMethod("byteswap_32", "Byte swaps 'dword'")]
|
||||
public static uint Byteswap32(uint val)
|
||||
{
|
||||
|
@ -101,6 +115,7 @@ namespace BizHawk.Client.Common
|
|||
(val & 0x00FF0000U) >> 8 | (val & 0xFF000000U) >> 24;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local ulbitbyt = bit.byteswap_64( 10000 );")]
|
||||
[LuaMethod("byteswap_64", "Byte swaps 'long'")]
|
||||
public static ulong Byteswap64(ulong val)
|
||||
{
|
||||
|
|
|
@ -48,24 +48,28 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public override string Name => "emu";
|
||||
|
||||
[LuaMethodExample("emu.displayvsync( true );")]
|
||||
[LuaMethod("displayvsync", "Sets the display vsync property of the emulator")]
|
||||
public static void DisplayVsync(bool enabled)
|
||||
{
|
||||
Global.Config.VSync = enabled;
|
||||
}
|
||||
|
||||
[LuaMethodExample("emu.frameadvance( );")]
|
||||
[LuaMethod("frameadvance", "Signals to the emulator to resume emulation. Necessary for any lua script while loop or else the emulator will freeze!")]
|
||||
public void FrameAdvance()
|
||||
{
|
||||
FrameAdvanceCallback();
|
||||
}
|
||||
|
||||
[LuaMethodExample("local inemufra = emu.framecount( );")]
|
||||
[LuaMethod("framecount", "Returns the current frame count")]
|
||||
public int FrameCount()
|
||||
{
|
||||
return Emulator.Frame;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local obemudis = emu.disassemble( 0x8000 );")]
|
||||
[LuaMethod("disassemble", "Returns the disassembly object (disasm string and length int) for the given PC address. Uses System Bus domain if no domain name provided")]
|
||||
public object Disassemble(uint pc, string name = "")
|
||||
{
|
||||
|
@ -95,6 +99,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
|
||||
// TODO: what about 64 bit registers?
|
||||
[LuaMethodExample("local inemuget = emu.getregister( emu.getregisters( )[ 0 ] );")]
|
||||
[LuaMethod("getregister", "returns the value of a cpu register or flag specified by name. For a complete list of possible registers or flags for a given core, use getregisters")]
|
||||
public int GetRegister(string name)
|
||||
{
|
||||
|
@ -117,6 +122,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("local nlemuget = emu.getregisters( );")]
|
||||
[LuaMethod("getregisters", "returns the complete set of available flags and registers for a given core")]
|
||||
public LuaTable GetRegisters()
|
||||
{
|
||||
|
@ -142,6 +148,7 @@ namespace BizHawk.Client.Common
|
|||
return table;
|
||||
}
|
||||
|
||||
[LuaMethodExample("emu.setregister( emu.getregisters( )[ 0 ], -1000 );")]
|
||||
[LuaMethod("setregister", "sets the given register name to the given value")]
|
||||
public void SetRegister(string register, int value)
|
||||
{
|
||||
|
@ -160,6 +167,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("local inemutot = emu.totalexecutedcycles( );")]
|
||||
[LuaMethod("totalexecutedcycles", "gets the total number of executed cpu cycles")]
|
||||
public int TotalExecutedycles()
|
||||
{
|
||||
|
@ -180,12 +188,14 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("local stemuget = emu.getsystemid( );")]
|
||||
[LuaMethod("getsystemid", "Returns the ID string of the current core loaded. Note: No ROM loaded will return the string NULL")]
|
||||
public static string GetSystemId()
|
||||
{
|
||||
return Global.Game.System;
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( emu.islagged( ) ) then\r\n\tconsole.log( \"Returns whether or not the current frame is a lag frame\" );\r\nend;")]
|
||||
[LuaMethod("islagged", "Returns whether or not the current frame is a lag frame")]
|
||||
public bool IsLagged()
|
||||
{
|
||||
|
@ -198,6 +208,7 @@ namespace BizHawk.Client.Common
|
|||
return false;
|
||||
}
|
||||
|
||||
[LuaMethodExample("emu.setislagged( true );")]
|
||||
[LuaMethod("setislagged", "Sets the lag flag for the current frame. If no value is provided, it will default to true")]
|
||||
public void SetIsLagged(bool value = true)
|
||||
{
|
||||
|
@ -211,6 +222,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("local inemulag = emu.lagcount( );")]
|
||||
[LuaMethod("lagcount", "Returns the current lag count")]
|
||||
public int LagCount()
|
||||
{
|
||||
|
@ -223,6 +235,7 @@ namespace BizHawk.Client.Common
|
|||
return 0;
|
||||
}
|
||||
|
||||
[LuaMethodExample("emu.setlagcount( 50 );")]
|
||||
[LuaMethod("setlagcount", "Sets the current lag count")]
|
||||
public void SetLagCount(int count)
|
||||
{
|
||||
|
@ -236,18 +249,21 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("emu.limitframerate( true );")]
|
||||
[LuaMethod("limitframerate", "sets the limit framerate property of the emulator")]
|
||||
public static void LimitFramerate(bool enabled)
|
||||
{
|
||||
Global.Config.ClockThrottle = enabled;
|
||||
}
|
||||
|
||||
[LuaMethodExample("emu.minimizeframeskip( true );")]
|
||||
[LuaMethod("minimizeframeskip", "Sets the autominimizeframeskip value of the emulator")]
|
||||
public static void MinimizeFrameskip(bool enabled)
|
||||
{
|
||||
Global.Config.AutoMinimizeSkipping = enabled;
|
||||
}
|
||||
|
||||
[LuaMethodExample("emu.setrenderplanes( true, false );")]
|
||||
[LuaMethod("setrenderplanes", "Toggles the drawing of sprites and background planes. Set to false or nil to disable a pane, anything else will draw them")]
|
||||
public void SetRenderPlanes(params bool[] luaParam)
|
||||
{
|
||||
|
@ -322,12 +338,14 @@ namespace BizHawk.Client.Common
|
|||
return true;
|
||||
}
|
||||
|
||||
[LuaMethodExample("emu.yield( );")]
|
||||
[LuaMethod("yield", "allows a script to run while emulation is paused and interact with the gui/main window in realtime ")]
|
||||
public void Yield()
|
||||
{
|
||||
YieldCallback();
|
||||
}
|
||||
|
||||
[LuaMethodExample("local stemuget = emu.getdisplaytype();")]
|
||||
[LuaMethod("getdisplaytype", "returns the display type (PAL vs NTSC) that the emulator is currently running in")]
|
||||
public string GetDisplayType()
|
||||
{
|
||||
|
@ -339,6 +357,7 @@ namespace BizHawk.Client.Common
|
|||
return "";
|
||||
}
|
||||
|
||||
[LuaMethodExample("local stemuget = emu.getboardname();")]
|
||||
[LuaMethod("getboardname", "returns (if available) the board name of the loaded ROM")]
|
||||
public string GetBoardName()
|
||||
{
|
||||
|
@ -349,5 +368,11 @@ namespace BizHawk.Client.Common
|
|||
|
||||
return "";
|
||||
}
|
||||
|
||||
[LuaMethod("getluacore", "returns the name of the Lua core currently in use")]
|
||||
public string GetLuaBackend()
|
||||
{
|
||||
return Lua.WhichLua;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,9 @@ namespace BizHawk.Client.Common
|
|||
[RequiredService]
|
||||
private IEmulator Emulator { get; set; }
|
||||
|
||||
[OptionalService]
|
||||
private IMemoryDomains Domains { get; set; }
|
||||
|
||||
private readonly LuaFunctionList _luaFunctions = new LuaFunctionList();
|
||||
|
||||
public EventLuaLibrary(Lua lua)
|
||||
|
@ -156,6 +159,8 @@ namespace BizHawk.Client.Common
|
|||
|
||||
#endregion
|
||||
|
||||
|
||||
[LuaMethodExample("local steveonf = event.onframeend(\r\n\tfunction()\r\n\t\tconsole.log( \"Calls the given lua function at the end of each frame, after all emulation and drawing has completed. Note: this is the default behavior of lua scripts\" );\r\n\tend\r\n\t, \"Frame name\" );")]
|
||||
[LuaMethod("onframeend", "Calls the given lua function at the end of each frame, after all emulation and drawing has completed. Note: this is the default behavior of lua scripts")]
|
||||
public string OnFrameEnd(LuaFunction luaf, string name = null)
|
||||
{
|
||||
|
@ -164,6 +169,7 @@ namespace BizHawk.Client.Common
|
|||
return nlf.Guid.ToString();
|
||||
}
|
||||
|
||||
[LuaMethodExample("local steveonf = event.onframestart(\r\n\tfunction()\r\n\t\tconsole.log( \"Calls the given lua function at the beginning of each frame before any emulation and drawing occurs\" );\r\n\tend\r\n\t, \"Frame name\" );")]
|
||||
[LuaMethod("onframestart", "Calls the given lua function at the beginning of each frame before any emulation and drawing occurs")]
|
||||
public string OnFrameStart(LuaFunction luaf, string name = null)
|
||||
{
|
||||
|
@ -172,6 +178,7 @@ namespace BizHawk.Client.Common
|
|||
return nlf.Guid.ToString();
|
||||
}
|
||||
|
||||
[LuaMethodExample("local steveoni = event.oninputpoll(\r\n\tfunction()\r\n\t\tconsole.log( \"Calls the given lua function after each time the emulator core polls for input\" );\r\n\tend\r\n\t, \"Frame name\" );")]
|
||||
[LuaMethod("oninputpoll", "Calls the given lua function after each time the emulator core polls for input")]
|
||||
public string OnInputPoll(LuaFunction luaf, string name = null)
|
||||
{
|
||||
|
@ -201,6 +208,7 @@ namespace BizHawk.Client.Common
|
|||
Log($"Error: {Emulator.Attributes().CoreName} does not yet implement input polling callbacks");
|
||||
}
|
||||
|
||||
[LuaMethodExample("local steveonl = event.onloadstate(\r\n\tfunction()\r\n\tconsole.log( \"Fires after a state is loaded. Receives a lua function name, and registers it to the event immediately following a successful savestate event\" );\r\nend\", \"Frame name\" );")]
|
||||
[LuaMethod("onloadstate", "Fires after a state is loaded. Receives a lua function name, and registers it to the event immediately following a successful savestate event")]
|
||||
public string OnLoadState(LuaFunction luaf, string name = null)
|
||||
{
|
||||
|
@ -209,8 +217,9 @@ namespace BizHawk.Client.Common
|
|||
return nlf.Guid.ToString();
|
||||
}
|
||||
|
||||
[LuaMethodExample("local steveonm = event.onmemoryexecute(\r\n\tfunction()\r\n\t\tconsole.log( \"Fires after the given address is executed by the core\" );\r\n\tend\r\n\t, 0x200, \"Frame name\", \"System Bus\" );")]
|
||||
[LuaMethod("onmemoryexecute", "Fires after the given address is executed by the core")]
|
||||
public string OnMemoryExecute(LuaFunction luaf, uint address, string name = null)
|
||||
public string OnMemoryExecute(LuaFunction luaf, uint address, string name = null, string domain = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -225,8 +234,16 @@ namespace BizHawk.Client.Common
|
|||
var nlf = new NamedLuaFunction(luaf, "OnMemoryExecute", LogOutputCallback, CurrentThread, name);
|
||||
_luaFunctions.Add(nlf);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(domain))
|
||||
{
|
||||
if (Domains != null && Domains.HasSystemBus)
|
||||
{
|
||||
domain = Domains.SystemBus.Name;
|
||||
}
|
||||
}
|
||||
|
||||
DebuggableCore.MemoryCallbacks.Add(
|
||||
new MemoryCallback(MemoryCallbackType.Execute, "Lua Hook", nlf.Callback, address, null));
|
||||
new MemoryCallback(domain, MemoryCallbackType.Execute, "Lua Hook", nlf.Callback, address, null));
|
||||
return nlf.Guid.ToString();
|
||||
}
|
||||
}
|
||||
|
@ -240,8 +257,9 @@ namespace BizHawk.Client.Common
|
|||
return Guid.Empty.ToString();
|
||||
}
|
||||
|
||||
[LuaMethodExample("local steveonm = event.onmemoryread(\r\n\tfunction()\r\n\t\tconsole.log( \"Fires after the given address is read by the core. If no address is given, it will attach to every memory read\" );\r\n\tend\r\n\t, 0x200, \"Frame name\" );")]
|
||||
[LuaMethod("onmemoryread", "Fires after the given address is read by the core. If no address is given, it will attach to every memory read")]
|
||||
public string OnMemoryRead(LuaFunction luaf, uint? address = null, string name = null)
|
||||
public string OnMemoryRead(LuaFunction luaf, uint? address = null, string name = null, string domain = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -255,8 +273,16 @@ namespace BizHawk.Client.Common
|
|||
var nlf = new NamedLuaFunction(luaf, "OnMemoryRead", LogOutputCallback, CurrentThread, name);
|
||||
_luaFunctions.Add(nlf);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(domain))
|
||||
{
|
||||
if (Domains != null && Domains.HasSystemBus)
|
||||
{
|
||||
domain = Domains.SystemBus.Name;
|
||||
}
|
||||
}
|
||||
|
||||
DebuggableCore.MemoryCallbacks.Add(
|
||||
new MemoryCallback(MemoryCallbackType.Read, "Lua Hook", nlf.Callback, address, null));
|
||||
new MemoryCallback(domain, MemoryCallbackType.Read, "Lua Hook", nlf.Callback, address, null));
|
||||
return nlf.Guid.ToString();
|
||||
}
|
||||
}
|
||||
|
@ -270,8 +296,9 @@ namespace BizHawk.Client.Common
|
|||
return Guid.Empty.ToString();
|
||||
}
|
||||
|
||||
[LuaMethodExample("local steveonm = event.onmemorywrite(\r\n\tfunction()\r\n\t\tconsole.log( \"Fires after the given address is written by the core. If no address is given, it will attach to every memory write\" );\r\n\tend\r\n\t, 0x200, \"Frame name\" );")]
|
||||
[LuaMethod("onmemorywrite", "Fires after the given address is written by the core. If no address is given, it will attach to every memory write")]
|
||||
public string OnMemoryWrite(LuaFunction luaf, uint? address = null, string name = null)
|
||||
public string OnMemoryWrite(LuaFunction luaf, uint? address = null, string name = null, string domain = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -285,8 +312,16 @@ namespace BizHawk.Client.Common
|
|||
var nlf = new NamedLuaFunction(luaf, "OnMemoryWrite", LogOutputCallback, CurrentThread, name);
|
||||
_luaFunctions.Add(nlf);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(domain))
|
||||
{
|
||||
if (Domains != null && Domains.HasSystemBus)
|
||||
{
|
||||
domain = Domains.SystemBus.Name;
|
||||
}
|
||||
}
|
||||
|
||||
DebuggableCore.MemoryCallbacks.Add(
|
||||
new MemoryCallback(MemoryCallbackType.Write, "Lua Hook", nlf.Callback, address, null));
|
||||
new MemoryCallback(domain, MemoryCallbackType.Write, "Lua Hook", nlf.Callback, address, null));
|
||||
return nlf.Guid.ToString();
|
||||
}
|
||||
}
|
||||
|
@ -300,6 +335,7 @@ namespace BizHawk.Client.Common
|
|||
return Guid.Empty.ToString();
|
||||
}
|
||||
|
||||
[LuaMethodExample("local steveons = event.onsavestate(\r\n\tfunction()\r\n\t\tconsole.log( \"Fires after a state is saved\" );\r\n\tend\r\n\t, \"Frame name\" );")]
|
||||
[LuaMethod("onsavestate", "Fires after a state is saved")]
|
||||
public string OnSaveState(LuaFunction luaf, string name = null)
|
||||
{
|
||||
|
@ -308,6 +344,7 @@ namespace BizHawk.Client.Common
|
|||
return nlf.Guid.ToString();
|
||||
}
|
||||
|
||||
[LuaMethodExample("local steveone = event.onexit(\r\n\tfunction()\r\n\t\tconsole.log( \"Fires after the calling script has stopped\" );\r\n\tend\r\n\t, \"Frame name\" );")]
|
||||
[LuaMethod("onexit", "Fires after the calling script has stopped")]
|
||||
public string OnExit(LuaFunction luaf, string name = null)
|
||||
{
|
||||
|
@ -316,6 +353,7 @@ namespace BizHawk.Client.Common
|
|||
return nlf.Guid.ToString();
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( event.unregisterbyid( \"4d1810b7 - 0d28 - 4acb - 9d8b - d87721641551\" ) ) then\r\n\tconsole.log( \"Removes the registered function that matches the guid.If a function is found and remove the function will return true.If unable to find a match, the function will return false.\" );\r\nend;")]
|
||||
[LuaMethod("unregisterbyid", "Removes the registered function that matches the guid. If a function is found and remove the function will return true. If unable to find a match, the function will return false.")]
|
||||
public bool UnregisterById(string guid)
|
||||
{
|
||||
|
@ -328,6 +366,7 @@ namespace BizHawk.Client.Common
|
|||
return false;
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( event.unregisterbyname( \"Function name\" ) ) then\r\n\tconsole.log( \"Removes the first registered function that matches Name.If a function is found and remove the function will return true.If unable to find a match, the function will return false.\" );\r\nend;")]
|
||||
[LuaMethod("unregisterbyname", "Removes the first registered function that matches Name. If a function is found and remove the function will return true. If unable to find a match, the function will return false.")]
|
||||
public bool UnregisterByName(string name)
|
||||
{
|
||||
|
|
|
@ -18,6 +18,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public override string Name => "gameinfo";
|
||||
|
||||
[LuaMethodExample("local stgamget = gameinfo.getromname( );")]
|
||||
[LuaMethod("getromname", "returns the path of the currently loaded rom, if a rom is loaded")]
|
||||
public string GetRomName()
|
||||
{
|
||||
|
@ -29,6 +30,7 @@ namespace BizHawk.Client.Common
|
|||
return "";
|
||||
}
|
||||
|
||||
[LuaMethodExample("local stgamget = gameinfo.getromhash( );")]
|
||||
[LuaMethod("getromhash", "returns the hash of the currently loaded rom, if a rom is loaded")]
|
||||
public string GetRomHash()
|
||||
{
|
||||
|
@ -40,6 +42,7 @@ namespace BizHawk.Client.Common
|
|||
return "";
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( gameinfo.indatabase( ) ) then\r\n\tconsole.log( \"returns whether or not the currently loaded rom is in the game database\" );\r\nend;")]
|
||||
[LuaMethod("indatabase", "returns whether or not the currently loaded rom is in the game database")]
|
||||
public bool InDatabase()
|
||||
{
|
||||
|
@ -51,6 +54,7 @@ namespace BizHawk.Client.Common
|
|||
return false;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local stgamget = gameinfo.getstatus( );")]
|
||||
[LuaMethod("getstatus", "returns the game database status of the currently loaded rom. Statuses are for example: GoodDump, BadDump, Hack, Unknown, NotInDatabase")]
|
||||
public string GetStatus()
|
||||
{
|
||||
|
@ -62,6 +66,7 @@ namespace BizHawk.Client.Common
|
|||
return "";
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( gameinfo.isstatusbad( ) ) then\r\n\tconsole.log( \"returns the currently loaded rom's game database status is considered 'bad'\" );\r\nend;")]
|
||||
[LuaMethod("isstatusbad", "returns the currently loaded rom's game database status is considered 'bad'")]
|
||||
public bool IsStatusBad()
|
||||
{
|
||||
|
@ -73,12 +78,14 @@ namespace BizHawk.Client.Common
|
|||
return true;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local stgamget = gameinfo.getboardtype( );")]
|
||||
[LuaMethod("getboardtype", "returns identifying information about the 'mapper' or similar capability used for this game. empty if no such useful distinction can be drawn")]
|
||||
public string GetBoardType()
|
||||
{
|
||||
return BoardInfo?.BoardName ?? "";
|
||||
}
|
||||
|
||||
[LuaMethodExample("local nlgamget = gameinfo.getoptions( );")]
|
||||
[LuaMethod("getoptions", "returns the game options for the currently loaded rom. Options vary per platform")]
|
||||
public LuaTable GetOptions()
|
||||
{
|
||||
|
|
|
@ -37,24 +37,28 @@ namespace BizHawk.Client.Common
|
|||
Genesis?.PutSettings(settings);
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( genesis.getlayer_bga( ) ) then\r\n\tconsole.log( \"Returns whether the bg layer A is displayed\" );\r\nend;")]
|
||||
[LuaMethod("getlayer_bga", "Returns whether the bg layer A is displayed")]
|
||||
public bool GetLayerBgA()
|
||||
{
|
||||
return GetSettings().DrawBGA;
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( genesis.getlayer_bgb( ) ) then\r\n\tconsole.log( \"Returns whether the bg layer B is displayed\" );\r\nend;")]
|
||||
[LuaMethod("getlayer_bgb", "Returns whether the bg layer B is displayed")]
|
||||
public bool GetLayerBgB()
|
||||
{
|
||||
return GetSettings().DrawBGB;
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( genesis.getlayer_bgw( ) ) then\r\n\tconsole.log( \"Returns whether the bg layer W is displayed\" );\r\nend;")]
|
||||
[LuaMethod("getlayer_bgw", "Returns whether the bg layer W is displayed")]
|
||||
public bool GetLayerBgW()
|
||||
{
|
||||
return GetSettings().DrawBGW;
|
||||
}
|
||||
|
||||
[LuaMethodExample("genesis.setlayer_bga( true );")]
|
||||
[LuaMethod("setlayer_bga", "Sets whether the bg layer A is displayed")]
|
||||
public void SetLayerBgA(bool value)
|
||||
{
|
||||
|
@ -63,6 +67,7 @@ namespace BizHawk.Client.Common
|
|||
PutSettings(s);
|
||||
}
|
||||
|
||||
[LuaMethodExample("genesis.setlayer_bgb( true );")]
|
||||
[LuaMethod("setlayer_bgb", "Sets whether the bg layer B is displayed")]
|
||||
public void SetLayerBgB(bool value)
|
||||
{
|
||||
|
@ -71,6 +76,7 @@ namespace BizHawk.Client.Common
|
|||
PutSettings(s);
|
||||
}
|
||||
|
||||
[LuaMethodExample("genesis.setlayer_bgw( true );")]
|
||||
[LuaMethod("setlayer_bgw", "Sets whether the bg layer W is displayed")]
|
||||
public void SetLayerBgW(bool value)
|
||||
{
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public override string Name => "joypad";
|
||||
|
||||
[LuaMethodExample("local nljoyget = joypad.get( 1 );")]
|
||||
[LuaMethod("get", "returns a lua table of the controller buttons pressed. If supplied, it will only return a table of buttons for the given controller")]
|
||||
public LuaTable Get(int? controller = null)
|
||||
{
|
||||
|
@ -50,6 +51,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
|
||||
// TODO: what about float controls?
|
||||
[LuaMethodExample("local nljoyget = joypad.getimmediate( );")]
|
||||
[LuaMethod("getimmediate", "returns a lua table of any controller buttons currently pressed by the user")]
|
||||
public LuaTable GetImmediate()
|
||||
{
|
||||
|
@ -62,6 +64,7 @@ namespace BizHawk.Client.Common
|
|||
return buttons;
|
||||
}
|
||||
|
||||
[LuaMethodExample("joypad.setfrommnemonicstr( \"| 0, 0, 0, 100,...R..B....|\" );")]
|
||||
[LuaMethod("setfrommnemonicstr", "sets the given buttons to their provided values for the current frame, string will be interpretted the same way an entry from a movie input log would be")]
|
||||
public void SetFromMnemonicStr(string inputLogEntry)
|
||||
{
|
||||
|
@ -86,6 +89,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("joypad.set( { [\"Left\"] = true, [ \"A\" ] = true, [ \"B\" ] = true } );")]
|
||||
[LuaMethod("set", "sets the given buttons to their provided values for the current frame")]
|
||||
public void Set(LuaTable buttons, int? controller = null)
|
||||
{
|
||||
|
@ -146,10 +150,11 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
catch
|
||||
{
|
||||
/*Eat it*/
|
||||
/*Eat it*/
|
||||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("joypad.setanalog( { [ \"Tilt X\" ] = true, [ \"Tilt Y\" ] = false } );")]
|
||||
[LuaMethod("setanalog", "sets the given analog controls to their provided values for the current frame. Note that unlike set() there is only the logic of overriding with the given value.")]
|
||||
public void SetAnalog(LuaTable controls, object controller = null)
|
||||
{
|
||||
|
|
|
@ -37,12 +37,14 @@ namespace BizHawk.Client.Common
|
|||
|
||||
#region Unique Library Methods
|
||||
|
||||
[LuaMethodExample("local stmaiget = mainmemory.getname( );")]
|
||||
[LuaMethod("getname", "returns the name of the domain defined as main memory for the given core")]
|
||||
public string GetName()
|
||||
{
|
||||
return Domain.Name;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local uimaiget = mainmemory.getcurrentmemorydomainsize( );")]
|
||||
[LuaMethod("getcurrentmemorydomainsize", "Returns the number of bytes of the domain defined as main memory")]
|
||||
public uint GetSize()
|
||||
{
|
||||
|
@ -53,36 +55,42 @@ namespace BizHawk.Client.Common
|
|||
|
||||
#region Common Special and Legacy Methods
|
||||
|
||||
[LuaMethodExample("local uimairea = mainmemory.readbyte( 0x100 );")]
|
||||
[LuaMethod("readbyte", "gets the value from the given address as an unsigned byte")]
|
||||
public uint ReadByte(int addr)
|
||||
{
|
||||
return ReadUnsignedByte(addr);
|
||||
}
|
||||
|
||||
[LuaMethodExample("mainmemory.writebyte( 0x100, 1000 );")]
|
||||
[LuaMethod("writebyte", "Writes the given value to the given address as an unsigned byte")]
|
||||
public void WriteByte(int addr, uint value)
|
||||
{
|
||||
WriteUnsignedByte(addr, value);
|
||||
}
|
||||
|
||||
[LuaMethodExample("local nlmairea = mainmemory.readbyterange( 0x100, 64 );")]
|
||||
[LuaMethod("readbyterange", "Reads the address range that starts from address, and is length long. Returns the result into a table of key value pairs (where the address is the key).")]
|
||||
public LuaTable ReadByteRange(int addr, int length)
|
||||
{
|
||||
return base.ReadByteRange(addr, length);
|
||||
}
|
||||
|
||||
[LuaMethodExample("")]
|
||||
[LuaMethod("writebyterange", "Writes the given values to the given addresses as unsigned bytes")]
|
||||
public void WriteByteRange(LuaTable memoryblock)
|
||||
{
|
||||
base.WriteByteRange(memoryblock);
|
||||
}
|
||||
|
||||
[LuaMethodExample("local simairea = mainmemory.readfloat(0x100, false);")]
|
||||
[LuaMethod("readfloat", "Reads the given address as a 32-bit float value from the main memory domain with th e given endian")]
|
||||
public float ReadFloat(int addr, bool bigendian)
|
||||
{
|
||||
return base.ReadFloat(addr, bigendian);
|
||||
}
|
||||
|
||||
[LuaMethodExample("mainmemory.writefloat( 0x100, 10.0, false );")]
|
||||
[LuaMethod("writefloat", "Writes the given 32-bit float value to the given address and endian")]
|
||||
public void WriteFloat(int addr, double value, bool bigendian)
|
||||
{
|
||||
|
@ -93,24 +101,28 @@ namespace BizHawk.Client.Common
|
|||
|
||||
#region 1 Byte
|
||||
|
||||
[LuaMethodExample("local inmairea = mainmemory.read_s8( 0x100 );")]
|
||||
[LuaMethod("read_s8", "read signed byte")]
|
||||
public int ReadS8(int addr)
|
||||
{
|
||||
return (sbyte)ReadUnsignedByte(addr);
|
||||
}
|
||||
|
||||
[LuaMethodExample("mainmemory.write_s8( 0x100, 1000 );")]
|
||||
[LuaMethod("write_s8", "write signed byte")]
|
||||
public void WriteS8(int addr, uint value)
|
||||
{
|
||||
WriteUnsignedByte(addr, value);
|
||||
}
|
||||
|
||||
[LuaMethodExample("local uimairea = mainmemory.read_u8( 0x100 );")]
|
||||
[LuaMethod("read_u8", "read unsigned byte")]
|
||||
public uint ReadU8(int addr)
|
||||
{
|
||||
return ReadUnsignedByte(addr);
|
||||
}
|
||||
|
||||
[LuaMethodExample("mainmemory.write_u8( 0x100, 1000 );")]
|
||||
[LuaMethod("write_u8", "write unsigned byte")]
|
||||
public void WriteU8(int addr, uint value)
|
||||
{
|
||||
|
@ -121,48 +133,56 @@ namespace BizHawk.Client.Common
|
|||
|
||||
#region 2 Byte
|
||||
|
||||
[LuaMethodExample("local inmairea = mainmemory.read_s16_le( 0x100 );")]
|
||||
[LuaMethod("read_s16_le", "read signed 2 byte value, little endian")]
|
||||
public int ReadS16Little(int addr)
|
||||
{
|
||||
return ReadSignedLittleCore(addr, 2);
|
||||
}
|
||||
|
||||
[LuaMethodExample("mainmemory.write_s16_le( 0x100, -1000 );")]
|
||||
[LuaMethod("write_s16_le", "write signed 2 byte value, little endian")]
|
||||
public void WriteS16Little(int addr, int value)
|
||||
{
|
||||
WriteSignedLittle(addr, value, 2);
|
||||
}
|
||||
|
||||
[LuaMethodExample("local inmairea = mainmemory.read_s16_be( 0x100 );")]
|
||||
[LuaMethod("read_s16_be", "read signed 2 byte value, big endian")]
|
||||
public int ReadS16Big(int addr)
|
||||
{
|
||||
return ReadSignedBig(addr, 2);
|
||||
}
|
||||
|
||||
[LuaMethodExample("mainmemory.write_s16_be( 0x100, -1000 );")]
|
||||
[LuaMethod("write_s16_be", "write signed 2 byte value, big endian")]
|
||||
public void WriteS16Big(int addr, int value)
|
||||
{
|
||||
WriteSignedBig(addr, value, 2);
|
||||
}
|
||||
|
||||
[LuaMethodExample("local uimairea = mainmemory.read_u16_le( 0x100 );")]
|
||||
[LuaMethod("read_u16_le", "read unsigned 2 byte value, little endian")]
|
||||
public uint ReadU16Little(int addr)
|
||||
{
|
||||
return ReadSignedLittle(addr, 2);
|
||||
}
|
||||
|
||||
[LuaMethodExample("mainmemory.write_u16_le( 0x100, 1000 );")]
|
||||
[LuaMethod("write_u16_le", "write unsigned 2 byte value, little endian")]
|
||||
public void WriteU16Little(int addr, uint value)
|
||||
{
|
||||
WriteUnsignedLittle(addr, value, 2);
|
||||
}
|
||||
|
||||
[LuaMethodExample("local uimairea = mainmemory.read_u16_be( 0x100 );")]
|
||||
[LuaMethod("read_u16_be", "read unsigned 2 byte value, big endian")]
|
||||
public uint ReadU16Big(int addr)
|
||||
{
|
||||
return ReadUnsignedBig(addr, 2);
|
||||
}
|
||||
|
||||
[LuaMethodExample("mainmemory.write_u16_be( 0x100, 1000 );")]
|
||||
[LuaMethod("write_u16_be", "write unsigned 2 byte value, big endian")]
|
||||
public void WriteU16Big(int addr, uint value)
|
||||
{
|
||||
|
@ -173,48 +193,56 @@ namespace BizHawk.Client.Common
|
|||
|
||||
#region 3 Byte
|
||||
|
||||
[LuaMethodExample("local inmairea = mainmemory.read_s24_le( 0x100 );")]
|
||||
[LuaMethod("read_s24_le", "read signed 24 bit value, little endian")]
|
||||
public int ReadS24Little(int addr)
|
||||
{
|
||||
return ReadSignedLittleCore(addr, 3);
|
||||
}
|
||||
|
||||
[LuaMethodExample("mainmemory.write_s24_le( 0x100, -1000 );")]
|
||||
[LuaMethod("write_s24_le", "write signed 24 bit value, little endian")]
|
||||
public void WriteS24Little(int addr, int value)
|
||||
{
|
||||
WriteSignedLittle(addr, value, 3);
|
||||
}
|
||||
|
||||
[LuaMethodExample("local inmairea = mainmemory.read_s24_be( 0x100 );")]
|
||||
[LuaMethod("read_s24_be", "read signed 24 bit value, big endian")]
|
||||
public int ReadS24Big(int addr)
|
||||
{
|
||||
return ReadSignedBig(addr, 3);
|
||||
}
|
||||
|
||||
[LuaMethodExample("mainmemory.write_s24_be( 0x100, -1000 );")]
|
||||
[LuaMethod("write_s24_be", "write signed 24 bit value, big endian")]
|
||||
public void WriteS24Big(int addr, int value)
|
||||
{
|
||||
WriteSignedBig(addr, value, 3);
|
||||
}
|
||||
|
||||
[LuaMethodExample("local uimairea = mainmemory.read_u24_le( 0x100 );")]
|
||||
[LuaMethod("read_u24_le", "read unsigned 24 bit value, little endian")]
|
||||
public uint ReadU24Little(int addr)
|
||||
{
|
||||
return ReadSignedLittle(addr, 3);
|
||||
}
|
||||
|
||||
[LuaMethodExample("mainmemory.write_u24_le( 0x100, 1000 );")]
|
||||
[LuaMethod("write_u24_le", "write unsigned 24 bit value, little endian")]
|
||||
public void WriteU24Little(int addr, uint value)
|
||||
{
|
||||
WriteUnsignedLittle(addr, value, 3);
|
||||
}
|
||||
|
||||
[LuaMethodExample("local uimairea = mainmemory.read_u24_be( 0x100 );")]
|
||||
[LuaMethod("read_u24_be", "read unsigned 24 bit value, big endian")]
|
||||
public uint ReadU24Big(int addr)
|
||||
{
|
||||
return ReadUnsignedBig(addr, 3);
|
||||
}
|
||||
|
||||
[LuaMethodExample("mainmemory.write_u24_be( 0x100, 1000 );")]
|
||||
[LuaMethod("write_u24_be", "write unsigned 24 bit value, big endian")]
|
||||
public void WriteU24Big(int addr, uint value)
|
||||
{
|
||||
|
@ -225,48 +253,56 @@ namespace BizHawk.Client.Common
|
|||
|
||||
#region 4 Byte
|
||||
|
||||
[LuaMethodExample("local inmairea = mainmemory.read_s32_le( 0x100 );")]
|
||||
[LuaMethod("read_s32_le", "read signed 4 byte value, little endian")]
|
||||
public int ReadS32Little(int addr)
|
||||
{
|
||||
return ReadSignedLittleCore(addr, 4);
|
||||
}
|
||||
|
||||
[LuaMethodExample("mainmemory.write_s32_le( 0x100, -1000 );")]
|
||||
[LuaMethod("write_s32_le", "write signed 4 byte value, little endian")]
|
||||
public void WriteS32Little(int addr, int value)
|
||||
{
|
||||
WriteSignedLittle(addr, value, 4);
|
||||
}
|
||||
|
||||
[LuaMethodExample("local inmairea = mainmemory.read_s32_be( 0x100 );")]
|
||||
[LuaMethod("read_s32_be", "read signed 4 byte value, big endian")]
|
||||
public int ReadS32Big(int addr)
|
||||
{
|
||||
return ReadSignedBig(addr, 4);
|
||||
}
|
||||
|
||||
[LuaMethodExample("mainmemory.write_s32_be( 0x100, -1000 );")]
|
||||
[LuaMethod("write_s32_be", "write signed 4 byte value, big endian")]
|
||||
public void WriteS32Big(int addr, int value)
|
||||
{
|
||||
WriteSignedBig(addr, value, 4);
|
||||
}
|
||||
|
||||
[LuaMethodExample("local uimairea = mainmemory.read_u32_le( 0x100 );")]
|
||||
[LuaMethod("read_u32_le", "read unsigned 4 byte value, little endian")]
|
||||
public uint ReadU32Little(int addr)
|
||||
{
|
||||
return ReadSignedLittle(addr, 4);
|
||||
}
|
||||
|
||||
[LuaMethodExample("mainmemory.write_u32_le( 0x100, 1000 );")]
|
||||
[LuaMethod("write_u32_le", "write unsigned 4 byte value, little endian")]
|
||||
public void WriteU32Little(int addr, uint value)
|
||||
{
|
||||
WriteUnsignedLittle(addr, value, 4);
|
||||
}
|
||||
|
||||
[LuaMethodExample("local uimairea = mainmemory.read_u32_be( 0x100 );")]
|
||||
[LuaMethod("read_u32_be", "read unsigned 4 byte value, big endian")]
|
||||
public uint ReadU32Big(int addr)
|
||||
{
|
||||
return ReadUnsignedBig(addr, 4);
|
||||
}
|
||||
|
||||
[LuaMethodExample("mainmemory.write_u32_be( 0x100, 1000 );")]
|
||||
[LuaMethod("write_u32_be", "write unsigned 4 byte value, big endian")]
|
||||
public void WriteU32Big(int addr, uint value)
|
||||
{
|
||||
|
|
|
@ -49,6 +49,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
#region Unique Library Methods
|
||||
|
||||
[LuaMethodExample("local nlmemget = memory.getmemorydomainlist();")]
|
||||
[LuaMethod("getmemorydomainlist", "Returns a string of the memory domains for the loaded platform core. List will be a single string delimited by line feeds")]
|
||||
public LuaTable GetMemoryDomainList()
|
||||
{
|
||||
|
@ -64,6 +65,7 @@ namespace BizHawk.Client.Common
|
|||
return table;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local uimemget = memory.getmemorydomainsize( mainmemory.getname( ) );")]
|
||||
[LuaMethod("getmemorydomainsize", "Returns the number of bytes of the specified memory domain. If no domain is specified, or the specified domain doesn't exist, returns the current domain size")]
|
||||
public uint GetMemoryDomainSize(string name = "")
|
||||
{
|
||||
|
@ -75,18 +77,21 @@ namespace BizHawk.Client.Common
|
|||
return (uint)DomainList[VerifyMemoryDomain(name)].Size;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local stmemget = memory.getcurrentmemorydomain( );")]
|
||||
[LuaMethod("getcurrentmemorydomain", "Returns a string name of the current memory domain selected by Lua. The default is Main memory")]
|
||||
public string GetCurrentMemoryDomain()
|
||||
{
|
||||
return Domain.Name;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local uimemget = memory.getcurrentmemorydomainsize( );")]
|
||||
[LuaMethod("getcurrentmemorydomainsize", "Returns the number of bytes of the current memory domain selected by Lua. The default is Main memory")]
|
||||
public uint GetCurrentMemoryDomainSize()
|
||||
{
|
||||
return (uint)Domain.Size;
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( memory.usememorydomain( mainmemory.getname( ) ) ) then\r\n\tconsole.log( \"Attempts to set the current memory domain to the given domain. If the name does not match a valid memory domain, the function returns false, else it returns true\" );\r\nend;")]
|
||||
[LuaMethod("usememorydomain", "Attempts to set the current memory domain to the given domain. If the name does not match a valid memory domain, the function returns false, else it returns true")]
|
||||
public bool UseMemoryDomain(string domain)
|
||||
{
|
||||
|
@ -109,6 +114,7 @@ namespace BizHawk.Client.Common
|
|||
return false;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local stmemhas = memory.hash_region( 0x100, 50, mainmemory.getname( ) );")]
|
||||
[LuaMethod("hash_region", "Returns a hash as a string of a region of memory, starting from addr, through count bytes. If the domain is unspecified, it uses the current region.")]
|
||||
public string HashRegion(int addr, int count, string domain = null)
|
||||
{
|
||||
|
@ -144,36 +150,42 @@ namespace BizHawk.Client.Common
|
|||
|
||||
#region Common Special and Legacy Methods
|
||||
|
||||
[LuaMethodExample("local uimemrea = memory.readbyte( 0x100, mainmemory.getname( ) );")]
|
||||
[LuaMethod("readbyte", "gets the value from the given address as an unsigned byte")]
|
||||
public uint ReadByte(int addr, string domain = null)
|
||||
{
|
||||
return ReadUnsignedByte(addr, domain);
|
||||
}
|
||||
|
||||
[LuaMethodExample("memory.writebyte( 0x100, 1000, mainmemory.getname( ) );")]
|
||||
[LuaMethod("writebyte", "Writes the given value to the given address as an unsigned byte")]
|
||||
public void WriteByte(int addr, uint value, string domain = null)
|
||||
{
|
||||
WriteUnsignedByte(addr, value, domain);
|
||||
}
|
||||
|
||||
[LuaMethodExample("local nlmemrea = memory.readbyterange( 0x100, 30, mainmemory.getname( ) );")]
|
||||
[LuaMethod("readbyterange", "Reads the address range that starts from address, and is length long. Returns the result into a table of key value pairs (where the address is the key).")]
|
||||
public new LuaTable ReadByteRange(int addr, int length, string domain = null)
|
||||
{
|
||||
return base.ReadByteRange(addr, length, domain);
|
||||
}
|
||||
|
||||
[LuaMethodExample("")]
|
||||
[LuaMethod("writebyterange", "Writes the given values to the given addresses as unsigned bytes")]
|
||||
public new void WriteByteRange(LuaTable memoryblock, string domain = null)
|
||||
{
|
||||
base.WriteByteRange(memoryblock, domain);
|
||||
}
|
||||
|
||||
[LuaMethodExample("local simemrea = memory.readfloat( 0x100, false, mainmemory.getname( ) );")]
|
||||
[LuaMethod("readfloat", "Reads the given address as a 32-bit float value from the main memory domain with th e given endian")]
|
||||
public new float ReadFloat(int addr, bool bigendian, string domain = null)
|
||||
{
|
||||
return base.ReadFloat(addr, bigendian, domain);
|
||||
}
|
||||
|
||||
[LuaMethodExample("memory.writefloat( 0x100, 10.0, false, mainmemory.getname( ) );")]
|
||||
[LuaMethod("writefloat", "Writes the given 32-bit float value to the given address and endian")]
|
||||
public new void WriteFloat(int addr, double value, bool bigendian, string domain = null)
|
||||
{
|
||||
|
@ -184,24 +196,28 @@ namespace BizHawk.Client.Common
|
|||
|
||||
#region 1 Byte
|
||||
|
||||
[LuaMethodExample("local inmemrea = memory.read_s8( 0x100, mainmemory.getname( ) );")]
|
||||
[LuaMethod("read_s8", "read signed byte")]
|
||||
public int ReadS8(int addr, string domain = null)
|
||||
{
|
||||
return (sbyte)ReadUnsignedByte(addr, domain);
|
||||
}
|
||||
|
||||
[LuaMethodExample("memory.write_s8( 0x100, 1000, mainmemory.getname( ) );")]
|
||||
[LuaMethod("write_s8", "write signed byte")]
|
||||
public void WriteS8(int addr, uint value, string domain = null)
|
||||
{
|
||||
WriteUnsignedByte(addr, value, domain);
|
||||
}
|
||||
|
||||
[LuaMethodExample("local uimemrea = memory.read_u8( 0x100, mainmemory.getname( ) );")]
|
||||
[LuaMethod("read_u8", "read unsigned byte")]
|
||||
public uint ReadU8(int addr, string domain = null)
|
||||
{
|
||||
return ReadUnsignedByte(addr, domain);
|
||||
}
|
||||
|
||||
[LuaMethodExample("memory.write_u8( 0x100, 1000, mainmemory.getname( ) );")]
|
||||
[LuaMethod("write_u8", "write unsigned byte")]
|
||||
public void WriteU8(int addr, uint value, string domain = null)
|
||||
{
|
||||
|
@ -212,48 +228,56 @@ namespace BizHawk.Client.Common
|
|||
|
||||
#region 2 Byte
|
||||
|
||||
[LuaMethodExample("local inmemrea = memory.read_s16_le( 0x100, mainmemory.getname( ) );")]
|
||||
[LuaMethod("read_s16_le", "read signed 2 byte value, little endian")]
|
||||
public int ReadS16Little(int addr, string domain = null)
|
||||
{
|
||||
return ReadSignedLittleCore(addr, 2, domain);
|
||||
}
|
||||
|
||||
[LuaMethodExample("memory.write_s16_le( 0x100, -1000, mainmemory.getname( ) );")]
|
||||
[LuaMethod("write_s16_le", "write signed 2 byte value, little endian")]
|
||||
public void WriteS16Little(int addr, int value, string domain = null)
|
||||
{
|
||||
WriteSignedLittle(addr, value, 2, domain);
|
||||
}
|
||||
|
||||
[LuaMethodExample("local inmemrea = memory.read_s16_be( 0x100, mainmemory.getname( ) );")]
|
||||
[LuaMethod("read_s16_be", "read signed 2 byte value, big endian")]
|
||||
public int ReadS16Big(int addr, string domain = null)
|
||||
{
|
||||
return ReadSignedBig(addr, 2, domain);
|
||||
}
|
||||
|
||||
[LuaMethodExample("memory.write_s16_be( 0x100, -1000, mainmemory.getname( ) );")]
|
||||
[LuaMethod("write_s16_be", "write signed 2 byte value, big endian")]
|
||||
public void WriteS16Big(int addr, int value, string domain = null)
|
||||
{
|
||||
WriteSignedBig(addr, value, 2, domain);
|
||||
}
|
||||
|
||||
[LuaMethodExample("local uimemrea = memory.read_u16_le( 0x100, mainmemory.getname( ) );")]
|
||||
[LuaMethod("read_u16_le", "read unsigned 2 byte value, little endian")]
|
||||
public uint ReadU16Little(int addr, string domain = null)
|
||||
{
|
||||
return ReadUnsignedLittle(addr, 2, domain);
|
||||
}
|
||||
|
||||
[LuaMethodExample("memory.write_u16_le( 0x100, 1000, mainmemory.getname( ) );")]
|
||||
[LuaMethod("write_u16_le", "write unsigned 2 byte value, little endian")]
|
||||
public void WriteU16Little(int addr, uint value, string domain = null)
|
||||
{
|
||||
WriteUnsignedLittle(addr, value, 2, domain);
|
||||
}
|
||||
|
||||
[LuaMethodExample("local uimemrea = memory.read_u16_be( 0x100, mainmemory.getname( ) );")]
|
||||
[LuaMethod("read_u16_be", "read unsigned 2 byte value, big endian")]
|
||||
public uint ReadU16Big(int addr, string domain = null)
|
||||
{
|
||||
return ReadUnsignedBig(addr, 2, domain);
|
||||
}
|
||||
|
||||
[LuaMethodExample("memory.write_u16_be( 0x100, 1000, mainmemory.getname( ) );")]
|
||||
[LuaMethod("write_u16_be", "write unsigned 2 byte value, big endian")]
|
||||
public void WriteU16Big(int addr, uint value, string domain = null)
|
||||
{
|
||||
|
@ -264,48 +288,56 @@ namespace BizHawk.Client.Common
|
|||
|
||||
#region 3 Byte
|
||||
|
||||
[LuaMethodExample("local inmemrea = memory.read_s24_le( 0x100, mainmemory.getname( ) );")]
|
||||
[LuaMethod("read_s24_le", "read signed 24 bit value, little endian")]
|
||||
public int ReadS24Little(int addr, string domain = null)
|
||||
{
|
||||
return ReadSignedLittleCore(addr, 3, domain);
|
||||
}
|
||||
|
||||
[LuaMethodExample("memory.write_s24_le( 0x100, -1000, mainmemory.getname( ) );")]
|
||||
[LuaMethod("write_s24_le", "write signed 24 bit value, little endian")]
|
||||
public void WriteS24Little(int addr, int value, string domain = null)
|
||||
{
|
||||
WriteSignedLittle(addr, value, 3, domain);
|
||||
}
|
||||
|
||||
[LuaMethodExample("local inmemrea = memory.read_s24_be( 0x100, mainmemory.getname( ) );")]
|
||||
[LuaMethod("read_s24_be", "read signed 24 bit value, big endian")]
|
||||
public int ReadS24Big(int addr, string domain = null)
|
||||
{
|
||||
return ReadSignedBig(addr, 3, domain);
|
||||
}
|
||||
|
||||
[LuaMethodExample("memory.write_s24_be( 0x100, -1000, mainmemory.getname( ) );")]
|
||||
[LuaMethod("write_s24_be", "write signed 24 bit value, big endian")]
|
||||
public void WriteS24Big(int addr, int value, string domain = null)
|
||||
{
|
||||
WriteSignedBig(addr, value, 3, domain);
|
||||
}
|
||||
|
||||
[LuaMethodExample("local uimemrea = memory.read_u24_le( 0x100, mainmemory.getname( ) );")]
|
||||
[LuaMethod("read_u24_le", "read unsigned 24 bit value, little endian")]
|
||||
public uint ReadU24Little(int addr, string domain = null)
|
||||
{
|
||||
return ReadUnsignedLittle(addr, 3, domain);
|
||||
}
|
||||
|
||||
[LuaMethodExample("memory.write_u24_le( 0x100, 1000, mainmemory.getname( ) );")]
|
||||
[LuaMethod("write_u24_le", "write unsigned 24 bit value, little endian")]
|
||||
public void WriteU24Little(int addr, uint value, string domain = null)
|
||||
{
|
||||
WriteUnsignedLittle(addr, value, 3, domain);
|
||||
}
|
||||
|
||||
[LuaMethodExample("local uimemrea = memory.read_u24_be( 0x100, mainmemory.getname( ) );")]
|
||||
[LuaMethod("read_u24_be", "read unsigned 24 bit value, big endian")]
|
||||
public uint ReadU24Big(int addr, string domain = null)
|
||||
{
|
||||
return ReadUnsignedBig(addr, 3, domain);
|
||||
}
|
||||
|
||||
[LuaMethodExample("memory.write_u24_be( 0x100, 1000, mainmemory.getname( ) );")]
|
||||
[LuaMethod("write_u24_be", "write unsigned 24 bit value, big endian")]
|
||||
public void WriteU24Big(int addr, uint value, string domain = null)
|
||||
{
|
||||
|
@ -316,48 +348,56 @@ namespace BizHawk.Client.Common
|
|||
|
||||
#region 4 Byte
|
||||
|
||||
[LuaMethodExample("local inmemrea = memory.read_s32_le( 0x100, mainmemory.getname( ) );")]
|
||||
[LuaMethod("read_s32_le", "read signed 4 byte value, little endian")]
|
||||
public int ReadS32Little(int addr, string domain = null)
|
||||
{
|
||||
return ReadSignedLittleCore(addr, 4, domain);
|
||||
}
|
||||
|
||||
[LuaMethodExample("memory.write_s32_le( 0x100, -1000, mainmemory.getname( ) );")]
|
||||
[LuaMethod("write_s32_le", "write signed 4 byte value, little endian")]
|
||||
public void WriteS32Little(int addr, int value, string domain = null)
|
||||
{
|
||||
WriteSignedLittle(addr, value, 4, domain);
|
||||
}
|
||||
|
||||
[LuaMethodExample("local inmemrea = memory.read_s32_be( 0x100, mainmemory.getname( ) );")]
|
||||
[LuaMethod("read_s32_be", "read signed 4 byte value, big endian")]
|
||||
public int ReadS32Big(int addr, string domain = null)
|
||||
{
|
||||
return ReadSignedBig(addr, 4, domain);
|
||||
}
|
||||
|
||||
[LuaMethodExample("memory.write_s32_be( 0x100, -1000, mainmemory.getname( ) );")]
|
||||
[LuaMethod("write_s32_be", "write signed 4 byte value, big endian")]
|
||||
public void WriteS32Big(int addr, int value, string domain = null)
|
||||
{
|
||||
WriteSignedBig(addr, value, 4, domain);
|
||||
}
|
||||
|
||||
[LuaMethodExample("local uimemrea = memory.read_u32_le( 0x100, mainmemory.getname( ) );")]
|
||||
[LuaMethod("read_u32_le", "read unsigned 4 byte value, little endian")]
|
||||
public uint ReadU32Little(int addr, string domain = null)
|
||||
{
|
||||
return ReadUnsignedLittle(addr, 4, domain);
|
||||
}
|
||||
|
||||
[LuaMethodExample("memory.write_u32_le( 0x100, 1000, mainmemory.getname( ) );")]
|
||||
[LuaMethod("write_u32_le", "write unsigned 4 byte value, little endian")]
|
||||
public void WriteU32Little(int addr, uint value, string domain = null)
|
||||
{
|
||||
WriteUnsignedLittle(addr, value, 4, domain);
|
||||
}
|
||||
|
||||
[LuaMethodExample("local uimemrea = memory.read_u32_be( 0x100, mainmemory.getname( ) );")]
|
||||
[LuaMethod("read_u32_be", "read unsigned 4 byte value, big endian")]
|
||||
public uint ReadU32Big(int addr, string domain = null)
|
||||
{
|
||||
return ReadUnsignedBig(addr, 4, domain);
|
||||
}
|
||||
|
||||
[LuaMethodExample("memory.write_u32_be( 0x100, 1000, mainmemory.getname( ) );")]
|
||||
[LuaMethod("write_u32_be", "write unsigned 4 byte value, big endian")]
|
||||
public void WriteU32Big(int addr, uint value, string domain = null)
|
||||
{
|
||||
|
|
|
@ -23,6 +23,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
private readonly Dictionary<Guid, byte[]> _memorySavestates = new Dictionary<Guid, byte[]>();
|
||||
|
||||
[LuaMethodExample("local mmsvstsvcst = memorysavestate.savecorestate( );")]
|
||||
[LuaMethod("savecorestate", "creates a core savestate and stores it in memory. Note: a core savestate is only the raw data from the core, and not extras such as movie input logs, or framebuffers. Returns a unique identifer for the savestate")]
|
||||
public string SaveCoreStateToMemory()
|
||||
{
|
||||
|
@ -34,6 +35,7 @@ namespace BizHawk.Client.Common
|
|||
return guid.ToString();
|
||||
}
|
||||
|
||||
[LuaMethodExample("memorysavestate.loadcorestate( \"3fcf120f-0778-43fd-b2c5-460fb7d34184\" );")]
|
||||
[LuaMethod("loadcorestate", "loads an in memory state with the given identifier")]
|
||||
public void LoadCoreStateFromMemory(string identifier)
|
||||
{
|
||||
|
@ -55,6 +57,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("memorysavestate.removestate( \"3fcf120f-0778-43fd-b2c5-460fb7d34184\" );")]
|
||||
[LuaMethod("removestate", "removes the savestate with the given identifier from memory")]
|
||||
public void DeleteState(string identifier)
|
||||
{
|
||||
|
@ -62,6 +65,7 @@ namespace BizHawk.Client.Common
|
|||
_memorySavestates.Remove(guid);
|
||||
}
|
||||
|
||||
[LuaMethodExample("memorysavestate.clearstatesfrommemory( );")]
|
||||
[LuaMethod("clearstatesfrommemory", "clears all savestates stored in memory")]
|
||||
public void ClearInMemoryStates()
|
||||
{
|
||||
|
|
|
@ -14,24 +14,28 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public override string Name => "movie";
|
||||
|
||||
[LuaMethodExample("if ( movie.startsfromsavestate( ) ) then\r\n\tconsole.log( \"Returns whether or not the movie is a savestate-anchored movie\" );\r\nend;")]
|
||||
[LuaMethod("startsfromsavestate", "Returns whether or not the movie is a savestate-anchored movie")]
|
||||
public bool StartsFromSavestate()
|
||||
{
|
||||
return Global.MovieSession.Movie.IsActive && Global.MovieSession.Movie.StartsFromSavestate;
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( movie.startsfromsaveram( ) ) then\r\n\tconsole.log( \"Returns whether or not the movie is a saveram-anchored movie\" );\r\nend;")]
|
||||
[LuaMethod("startsfromsaveram", "Returns whether or not the movie is a saveram-anchored movie")]
|
||||
public bool StartsFromSaveram()
|
||||
{
|
||||
return Global.MovieSession.Movie.IsActive && Global.MovieSession.Movie.StartsFromSaveRam;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local stmovfil = movie.filename( );")]
|
||||
[LuaMethod("filename", "Returns the file name including path of the currently loaded movie")]
|
||||
public static string Filename()
|
||||
{
|
||||
return Global.MovieSession.Movie.Filename;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local nlmovget = movie.getinput( 500 );")]
|
||||
[LuaMethod("getinput", "Returns a table of buttons pressed on a given frame of the loaded movie")]
|
||||
public LuaTable GetInput(int frame)
|
||||
{
|
||||
|
@ -63,6 +67,7 @@ namespace BizHawk.Client.Common
|
|||
return input;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local stmovget = movie.getinputasmnemonic( 500 );")]
|
||||
[LuaMethod("getinputasmnemonic", "Returns the input of a given frame of the loaded movie in a raw inputlog string")]
|
||||
public string GetInputAsMnemonic(int frame)
|
||||
{
|
||||
|
@ -76,36 +81,42 @@ namespace BizHawk.Client.Common
|
|||
return "";
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( movie.getreadonly( ) ) then\r\n\tconsole.log( \"Returns true if the movie is in read-only mode, false if in read+write\" );\r\nend;")]
|
||||
[LuaMethod("getreadonly", "Returns true if the movie is in read-only mode, false if in read+write")]
|
||||
public static bool GetReadOnly()
|
||||
{
|
||||
return Global.MovieSession.ReadOnly;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local ulmovget = movie.getrerecordcount();")]
|
||||
[LuaMethod("getrerecordcount", "Gets the rerecord count of the current movie.")]
|
||||
public static ulong GetRerecordCount()
|
||||
{
|
||||
return Global.MovieSession.Movie.Rerecords;
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( movie.getrerecordcounting( ) ) then\r\n\tconsole.log( \"Returns whether or not the current movie is incrementing rerecords on loadstate\" );\r\nend;")]
|
||||
[LuaMethod("getrerecordcounting", "Returns whether or not the current movie is incrementing rerecords on loadstate")]
|
||||
public static bool GetRerecordCounting()
|
||||
{
|
||||
return Global.MovieSession.Movie.IsCountingRerecords;
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( movie.isloaded( ) ) then\r\n\tconsole.log( \"Returns true if a movie is loaded in memory ( play, record, or finished modes ), false if not ( inactive mode )\" );\r\nend;")]
|
||||
[LuaMethod("isloaded", "Returns true if a movie is loaded in memory (play, record, or finished modes), false if not (inactive mode)")]
|
||||
public static bool IsLoaded()
|
||||
{
|
||||
return Global.MovieSession.Movie.IsActive;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local domovlen = movie.length( );")]
|
||||
[LuaMethod("length", "Returns the total number of frames of the loaded movie")]
|
||||
public static double Length()
|
||||
{
|
||||
return Global.MovieSession.Movie.FrameCount;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local stmovmod = movie.mode( );")]
|
||||
[LuaMethod("mode", "Returns the mode of the current movie. Possible modes: \"PLAY\", \"RECORD\", \"FINISHED\", \"INACTIVE\"")]
|
||||
public static string Mode()
|
||||
{
|
||||
|
@ -113,20 +124,21 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
return "FINISHED";
|
||||
}
|
||||
|
||||
|
||||
if (Global.MovieSession.Movie.IsPlaying)
|
||||
{
|
||||
return "PLAY";
|
||||
}
|
||||
|
||||
|
||||
if (Global.MovieSession.Movie.IsRecording)
|
||||
{
|
||||
return "RECORD";
|
||||
}
|
||||
|
||||
|
||||
return "INACTIVE";
|
||||
}
|
||||
|
||||
[LuaMethodExample("movie.save( \"C:\\moviename.ext\" );")]
|
||||
[LuaMethod("save", "Saves the current movie to the disc. If the filename is provided (no extension or path needed), the movie is saved under the specified name to the current movie directory. The filename may contain a subdirectory, it will be created if it doesn't exist. Existing files won't get overwritten.")]
|
||||
public void Save(string filename = "")
|
||||
{
|
||||
|
@ -151,12 +163,14 @@ namespace BizHawk.Client.Common
|
|||
Global.MovieSession.Movie.Save();
|
||||
}
|
||||
|
||||
[LuaMethodExample("movie.setreadonly( false );")]
|
||||
[LuaMethod("setreadonly", "Sets the read-only state to the given value. true for read only, false for read+write")]
|
||||
public static void SetReadOnly(bool readOnly)
|
||||
{
|
||||
Global.MovieSession.ReadOnly = readOnly;
|
||||
}
|
||||
|
||||
[LuaMethodExample("movie.setrerecordcount( 20.0 );")]
|
||||
[LuaMethod("setrerecordcount", "Sets the rerecord count of the current movie.")]
|
||||
public static void SetRerecordCount(double count)
|
||||
{
|
||||
|
@ -172,18 +186,21 @@ namespace BizHawk.Client.Common
|
|||
Global.MovieSession.Movie.Rerecords = (ulong)count;
|
||||
}
|
||||
|
||||
[LuaMethodExample("movie.setrerecordcounting( true );")]
|
||||
[LuaMethod("setrerecordcounting", "Sets whether or not the current movie will increment the rerecord counter on loadstate")]
|
||||
public static void SetRerecordCounting(bool counting)
|
||||
{
|
||||
Global.MovieSession.Movie.IsCountingRerecords = counting;
|
||||
}
|
||||
|
||||
[LuaMethodExample("movie.stop( );")]
|
||||
[LuaMethod("stop", "Stops the current movie")]
|
||||
public static void Stop()
|
||||
{
|
||||
Global.MovieSession.Movie.Stop();
|
||||
}
|
||||
|
||||
[LuaMethodExample("local domovget = movie.getfps( );")]
|
||||
[LuaMethod("getfps", "If a movie is loaded, gets the frames per second used by the movie to determine the movie length time")]
|
||||
public static double GetFps()
|
||||
{
|
||||
|
@ -200,6 +217,7 @@ namespace BizHawk.Client.Common
|
|||
return 0.0;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local nlmovget = movie.getheader( );")]
|
||||
[LuaMethod("getheader", "If a movie is active, will return the movie header as a lua table")]
|
||||
public LuaTable GetHeader()
|
||||
{
|
||||
|
@ -215,6 +233,7 @@ namespace BizHawk.Client.Common
|
|||
return luaTable;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local nlmovget = movie.getcomments( );")]
|
||||
[LuaMethod("getcomments", "If a movie is active, will return the movie comments as a lua table")]
|
||||
public LuaTable GetComments()
|
||||
{
|
||||
|
@ -230,6 +249,7 @@ namespace BizHawk.Client.Common
|
|||
return luaTable;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local nlmovget = movie.getsubtitles( );")]
|
||||
[LuaMethod("getsubtitles", "If a movie is active, will return the movie subtitles as a lua table")]
|
||||
public LuaTable GetSubtitles()
|
||||
{
|
||||
|
|
|
@ -38,6 +38,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public override string Name => "nes";
|
||||
|
||||
[LuaMethodExample("nes.addgamegenie( \"GXXZZLVI\" );")]
|
||||
[LuaMethod("addgamegenie", "Adds the specified game genie code. If an NES game is not currently loaded or the code is not a valid game genie code, this will have no effect")]
|
||||
public void AddGameGenie(string code)
|
||||
{
|
||||
|
@ -59,6 +60,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( nes.getallowmorethaneightsprites( ) ) then\r\n\tconsole.log( \"Gets the NES setting 'Allow more than 8 sprites per scanline' value\" );\r\nend;")]
|
||||
[LuaMethod("getallowmorethaneightsprites", "Gets the NES setting 'Allow more than 8 sprites per scanline' value")]
|
||||
public bool GetAllowMoreThanEightSprites()
|
||||
{
|
||||
|
@ -75,6 +77,7 @@ namespace BizHawk.Client.Common
|
|||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
[LuaMethodExample("local innesget = nes.getbottomscanline( false );")]
|
||||
[LuaMethod("getbottomscanline", "Gets the current value for the bottom scanline value")]
|
||||
public int GetBottomScanline(bool pal = false)
|
||||
{
|
||||
|
@ -93,6 +96,7 @@ namespace BizHawk.Client.Common
|
|||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( nes.getclipleftandright( ) ) then\r\n\tconsole.log( \"Gets the current value for the Clip Left and Right sides option\" );\r\nend;")]
|
||||
[LuaMethod("getclipleftandright", "Gets the current value for the Clip Left and Right sides option")]
|
||||
public bool GetClipLeftAndRight()
|
||||
{
|
||||
|
@ -109,6 +113,7 @@ namespace BizHawk.Client.Common
|
|||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( nes.getdispbackground( ) ) then\r\n\tconsole.log( \"Indicates whether or not the bg layer is being displayed\" );\r\nend;")]
|
||||
[LuaMethod("getdispbackground", "Indicates whether or not the bg layer is being displayed")]
|
||||
public bool GetDisplayBackground()
|
||||
{
|
||||
|
@ -125,6 +130,7 @@ namespace BizHawk.Client.Common
|
|||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( nes.getdispsprites( ) ) then\r\n\tconsole.log( \"Indicates whether or not sprites are being displayed\" );\r\nend;")]
|
||||
[LuaMethod("getdispsprites", "Indicates whether or not sprites are being displayed")]
|
||||
public bool GetDisplaySprites()
|
||||
{
|
||||
|
@ -141,6 +147,7 @@ namespace BizHawk.Client.Common
|
|||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
[LuaMethodExample("local innesget = nes.gettopscanline(false);")]
|
||||
[LuaMethod("gettopscanline", "Gets the current value for the top scanline value")]
|
||||
public int GetTopScanline(bool pal = false)
|
||||
{
|
||||
|
@ -159,6 +166,7 @@ namespace BizHawk.Client.Common
|
|||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
[LuaMethodExample("nes.removegamegenie( \"GXXZZLVI\" );")]
|
||||
[LuaMethod("removegamegenie", "Removes the specified game genie code. If an NES game is not currently loaded or the code is not a valid game genie code, this will have no effect")]
|
||||
public void RemoveGameGenie(string code)
|
||||
{
|
||||
|
@ -170,6 +178,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("nes.setallowmorethaneightsprites( true );")]
|
||||
[LuaMethod("setallowmorethaneightsprites", "Sets the NES setting 'Allow more than 8 sprites per scanline'")]
|
||||
public void SetAllowMoreThanEightSprites(bool allow)
|
||||
{
|
||||
|
@ -187,6 +196,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("nes.setclipleftandright( true );")]
|
||||
[LuaMethod("setclipleftandright", "Sets the Clip Left and Right sides option")]
|
||||
public void SetClipLeftAndRight(bool leftandright)
|
||||
{
|
||||
|
@ -204,6 +214,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("nes.setdispbackground( true );")]
|
||||
[LuaMethod("setdispbackground", "Sets whether or not the background layer will be displayed")]
|
||||
public void SetDisplayBackground(bool show)
|
||||
{
|
||||
|
@ -215,6 +226,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("nes.setdispsprites( true );")]
|
||||
[LuaMethod("setdispsprites", "Sets whether or not sprites will be displayed")]
|
||||
public void SetDisplaySprites(bool show)
|
||||
{
|
||||
|
@ -232,6 +244,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("nes.setscanlines( 10, 20, false );")]
|
||||
[LuaMethod("setscanlines", "sets the top and bottom scanlines to be drawn (same values as in the graphics options dialog). Top must be in the range of 0 to 127, bottom must be between 128 and 239. Not supported in the Quick Nes core")]
|
||||
public void SetScanlines(int top, int bottom, bool pal = false)
|
||||
{
|
||||
|
|
|
@ -35,54 +35,63 @@ namespace BizHawk.Client.Common
|
|||
Snes?.PutSettings(settings);
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( snes.getlayer_bg_1( ) ) then\r\n\tconsole.log( \"Returns whether the bg 1 layer is displayed\" );\r\nend;")]
|
||||
[LuaMethod("getlayer_bg_1", "Returns whether the bg 1 layer is displayed")]
|
||||
public bool GetLayerBg1()
|
||||
{
|
||||
return GetSettings().ShowBG1_1;
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( snes.getlayer_bg_2( ) ) then\r\n\tconsole.log( \"Returns whether the bg 2 layer is displayed\" );\r\nend;")]
|
||||
[LuaMethod("getlayer_bg_2", "Returns whether the bg 2 layer is displayed")]
|
||||
public bool GetLayerBg2()
|
||||
{
|
||||
return GetSettings().ShowBG2_1;
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( snes.getlayer_bg_3( ) ) then\r\n\tconsole.log( \"Returns whether the bg 3 layer is displayed\" );\r\nend;")]
|
||||
[LuaMethod("getlayer_bg_3", "Returns whether the bg 3 layer is displayed")]
|
||||
public bool GetLayerBg3()
|
||||
{
|
||||
return GetSettings().ShowBG3_1;
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( snes.getlayer_bg_4( ) ) then\r\n\tconsole.log( \"Returns whether the bg 4 layer is displayed\" );\r\nend;")]
|
||||
[LuaMethod("getlayer_bg_4", "Returns whether the bg 4 layer is displayed")]
|
||||
public bool GetLayerBg4()
|
||||
{
|
||||
return GetSettings().ShowBG4_1;
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( snes.getlayer_obj_1( ) ) then\r\n\tconsole.log( \"Returns whether the obj 1 layer is displayed\" );\r\nend;")]
|
||||
[LuaMethod("getlayer_obj_1", "Returns whether the obj 1 layer is displayed")]
|
||||
public bool GetLayerObj1()
|
||||
{
|
||||
return GetSettings().ShowOBJ_0;
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( snes.getlayer_obj_2( ) ) then\r\n\tconsole.log( \"Returns whether the obj 2 layer is displayed\" );\r\nend;")]
|
||||
[LuaMethod("getlayer_obj_2", "Returns whether the obj 2 layer is displayed")]
|
||||
public bool GetLayerObj2()
|
||||
{
|
||||
return GetSettings().ShowOBJ_1;
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( snes.getlayer_obj_3( ) ) then\r\n\tconsole.log( \"Returns whether the obj 3 layer is displayed\" );\r\nend;")]
|
||||
[LuaMethod("getlayer_obj_3", "Returns whether the obj 3 layer is displayed")]
|
||||
public bool GetLayerObj3()
|
||||
{
|
||||
return GetSettings().ShowOBJ_2;
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( snes.getlayer_obj_4( ) ) then\r\n\tconsole.log( \"Returns whether the obj 4 layer is displayed\" );\r\nend;")]
|
||||
[LuaMethod("getlayer_obj_4", "Returns whether the obj 4 layer is displayed")]
|
||||
public bool GetLayerObj4()
|
||||
{
|
||||
return GetSettings().ShowOBJ_3;
|
||||
}
|
||||
|
||||
[LuaMethodExample("snes.setlayer_bg_1( true );")]
|
||||
[LuaMethod("setlayer_bg_1", "Sets whether the bg 1 layer is displayed")]
|
||||
public void SetLayerBg1(bool value)
|
||||
{
|
||||
|
@ -91,6 +100,7 @@ namespace BizHawk.Client.Common
|
|||
PutSettings(s);
|
||||
}
|
||||
|
||||
[LuaMethodExample("snes.setlayer_bg_2( true );")]
|
||||
[LuaMethod("setlayer_bg_2", "Sets whether the bg 2 layer is displayed")]
|
||||
public void SetLayerBg2(bool value)
|
||||
{
|
||||
|
@ -99,6 +109,7 @@ namespace BizHawk.Client.Common
|
|||
PutSettings(s);
|
||||
}
|
||||
|
||||
[LuaMethodExample("snes.setlayer_bg_3( true );")]
|
||||
[LuaMethod("setlayer_bg_3", "Sets whether the bg 3 layer is displayed")]
|
||||
public void SetLayerBg3(bool value)
|
||||
{
|
||||
|
@ -107,6 +118,7 @@ namespace BizHawk.Client.Common
|
|||
PutSettings(s);
|
||||
}
|
||||
|
||||
[LuaMethodExample("snes.setlayer_bg_4( true );")]
|
||||
[LuaMethod("setlayer_bg_4", "Sets whether the bg 4 layer is displayed")]
|
||||
public void SetLayerBg4(bool value)
|
||||
{
|
||||
|
@ -115,6 +127,7 @@ namespace BizHawk.Client.Common
|
|||
PutSettings(s);
|
||||
}
|
||||
|
||||
[LuaMethodExample("snes.setlayer_obj_1( true );")]
|
||||
[LuaMethod("setlayer_obj_1", "Sets whether the obj 1 layer is displayed")]
|
||||
public void SetLayerObj1(bool value)
|
||||
{
|
||||
|
@ -123,6 +136,7 @@ namespace BizHawk.Client.Common
|
|||
PutSettings(s);
|
||||
}
|
||||
|
||||
[LuaMethodExample("snes.setlayer_obj_2( true );")]
|
||||
[LuaMethod("setlayer_obj_2", "Sets whether the obj 2 layer is displayed")]
|
||||
public void SetLayerObj2(bool value)
|
||||
{
|
||||
|
@ -131,6 +145,7 @@ namespace BizHawk.Client.Common
|
|||
PutSettings(s);
|
||||
}
|
||||
|
||||
[LuaMethodExample("snes.setlayer_obj_3( true );")]
|
||||
[LuaMethod("setlayer_obj_3", "Sets whether the obj 3 layer is displayed")]
|
||||
public void SetLayerObj3(bool value)
|
||||
{
|
||||
|
@ -139,6 +154,7 @@ namespace BizHawk.Client.Common
|
|||
PutSettings(s);
|
||||
}
|
||||
|
||||
[LuaMethodExample("snes.setlayer_obj_4( true );")]
|
||||
[LuaMethod("setlayer_obj_4", "Sets whether the obj 4 layer is displayed")]
|
||||
public void SetLayerObj4(bool value)
|
||||
{
|
||||
|
|
|
@ -21,7 +21,8 @@ namespace BizHawk.Client.Common
|
|||
SQLiteConnection m_dbConnection;
|
||||
string connectionString;
|
||||
|
||||
[LuaMethod("createdatabase","Creates a SQLite Database. Name should end with .db")]
|
||||
[LuaMethodExample("local stSQLcre = SQL.createdatabase( \"eg_db\" );")]
|
||||
[LuaMethod("createdatabase", "Creates a SQLite Database. Name should end with .db")]
|
||||
public string CreateDatabase(string name)
|
||||
{
|
||||
try
|
||||
|
@ -37,6 +38,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
|
||||
|
||||
[LuaMethodExample("local stSQLope = SQL.opendatabase( \"eg_db\" );")]
|
||||
[LuaMethod("opendatabase", "Opens a SQLite database. Name should end with .db")]
|
||||
public string OpenDatabase(string name)
|
||||
{
|
||||
|
@ -54,15 +56,16 @@ namespace BizHawk.Client.Common
|
|||
m_dbConnection.Close();
|
||||
return "Database Opened Successfully";
|
||||
}
|
||||
catch(SQLiteException sqlEX)
|
||||
catch (SQLiteException sqlEX)
|
||||
{
|
||||
return sqlEX.Message;
|
||||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("local stSQLwri = SQL.writecommand( \"CREATE TABLE eg_tab ( eg_tab_id integer PRIMARY KEY, eg_tab_row_name text NOT NULL ); INSERT INTO eg_tab ( eg_tab_id, eg_tab_row_name ) VALUES ( 1, 'Example table row' );\" );")]
|
||||
[LuaMethod("writecommand", "Runs a SQLite write command which includes CREATE,INSERT, UPDATE. " +
|
||||
"Ex: create TABLE rewards (ID integer PRIMARY KEY, action VARCHAR(20)) ")]
|
||||
public string WriteCommand(string query="")
|
||||
public string WriteCommand(string query = "")
|
||||
{
|
||||
if (query == "")
|
||||
{
|
||||
|
@ -83,18 +86,19 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
return "Database not open.";
|
||||
}
|
||||
catch(SQLiteException sqlEX)
|
||||
catch (SQLiteException sqlEX)
|
||||
{
|
||||
m_dbConnection.Close();
|
||||
return sqlEX.Message;
|
||||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("local obSQLrea = SQL.readcommand( \"SELECT * FROM eg_tab WHERE eg_tab_id = 1;\" );")]
|
||||
[LuaMethod("readcommand", "Run a SQLite read command which includes Select. Returns all rows into a LuaTable." +
|
||||
"Ex: select * from rewards")]
|
||||
public dynamic ReadCommand(string query="")
|
||||
public dynamic ReadCommand(string query = "")
|
||||
{
|
||||
if (query=="")
|
||||
if (query == "")
|
||||
{
|
||||
return "query is empty";
|
||||
}
|
||||
|
@ -102,10 +106,10 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
var table = Lua.NewTable();
|
||||
m_dbConnection.Open();
|
||||
string sql = "PRAGMA read_uncommitted =1;"+query;
|
||||
string sql = "PRAGMA read_uncommitted =1;" + query;
|
||||
SQLiteCommand command = new SQLiteCommand(sql, m_dbConnection);
|
||||
SQLiteDataReader reader = command.ExecuteReader();
|
||||
bool rows=reader.HasRows;
|
||||
bool rows = reader.HasRows;
|
||||
long rowCount = 0;
|
||||
var columns = new List<string>();
|
||||
for (int i = 0; i < reader.FieldCount; ++i) //Add all column names into list
|
||||
|
@ -113,16 +117,16 @@ namespace BizHawk.Client.Common
|
|||
columns.Add(reader.GetName(i));
|
||||
}
|
||||
while (reader.Read())
|
||||
{
|
||||
{
|
||||
for (int i = 0; i < reader.FieldCount; ++i)
|
||||
{
|
||||
table[columns[i]+" "+rowCount.ToString()] = reader.GetValue(i);
|
||||
table[columns[i] + " " + rowCount.ToString()] = reader.GetValue(i);
|
||||
}
|
||||
rowCount += 1;
|
||||
}
|
||||
reader.Close();
|
||||
m_dbConnection.Close();
|
||||
if (rows==false)
|
||||
if (rows == false)
|
||||
{
|
||||
return "No rows found";
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace BizHawk.Client.Common
|
|||
public StringLuaLibrary(Lua lua, Action<string> logOutputCallback)
|
||||
: base(lua, logOutputCallback) { }
|
||||
|
||||
[LuaMethodExample("local stbizhex = bizstring.hex( -12345 );")]
|
||||
[LuaMethod("hex", "Converts the number to a string representation of the hexadecimal value of the given number")]
|
||||
public static string Hex(long num)
|
||||
{
|
||||
|
@ -29,6 +30,7 @@ namespace BizHawk.Client.Common
|
|||
return hex;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local stbizbin = bizstring.binary( -12345 );")]
|
||||
[LuaMethod("binary", "Converts the number to a string representation of the binary value of the given number")]
|
||||
public static string Binary(long num)
|
||||
{
|
||||
|
@ -37,6 +39,7 @@ namespace BizHawk.Client.Common
|
|||
return binary;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local stbizoct = bizstring.octal( -12345 );")]
|
||||
[LuaMethod("octal", "Converts the number to a string representation of the octal value of the given number")]
|
||||
public static string Octal(long num)
|
||||
{
|
||||
|
@ -49,6 +52,7 @@ namespace BizHawk.Client.Common
|
|||
return octal;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local stbiztri = bizstring.trim( \"Some trim string\t \" );")]
|
||||
[LuaMethod("trim", "returns a string that trims whitespace on the left and right ends of the string")]
|
||||
public static string Trim(string str)
|
||||
{
|
||||
|
@ -60,6 +64,7 @@ namespace BizHawk.Client.Common
|
|||
return str.Trim();
|
||||
}
|
||||
|
||||
[LuaMethodExample("local stbizrep = bizstring.replace( \"Some string\", \"Some\", \"Replaced\" );")]
|
||||
[LuaMethod("replace", "Returns a string that replaces all occurances of str2 in str1 with the value of replace")]
|
||||
public static string Replace(string str, string str2, string replace)
|
||||
{
|
||||
|
@ -71,6 +76,7 @@ namespace BizHawk.Client.Common
|
|||
return str.Replace(str2, replace);
|
||||
}
|
||||
|
||||
[LuaMethodExample("local stbiztou = bizstring.toupper( \"Some string\" );")]
|
||||
[LuaMethod("toupper", "Returns an uppercase version of the given string")]
|
||||
public static string ToUpper(string str)
|
||||
{
|
||||
|
@ -82,6 +88,7 @@ namespace BizHawk.Client.Common
|
|||
return str.ToUpper();
|
||||
}
|
||||
|
||||
[LuaMethodExample("local stbiztol = bizstring.tolower( \"Some string\" );")]
|
||||
[LuaMethod("tolower", "Returns an lowercase version of the given string")]
|
||||
public static string ToLower(string str)
|
||||
{
|
||||
|
@ -93,6 +100,7 @@ namespace BizHawk.Client.Common
|
|||
return str.ToLower();
|
||||
}
|
||||
|
||||
[LuaMethodExample("local stbizsub = bizstring.substring( \"Some string\", 6, 3 );")]
|
||||
[LuaMethod("substring", "Returns a string that represents a substring of str starting at position for the specified length")]
|
||||
public static string SubString(string str, int position, int length)
|
||||
{
|
||||
|
@ -104,6 +112,7 @@ namespace BizHawk.Client.Common
|
|||
return str.Substring(position, length);
|
||||
}
|
||||
|
||||
[LuaMethodExample("local stbizrem = bizstring.remove( \"Some string\", 4, 5 );")]
|
||||
[LuaMethod("remove", "Returns a string that represents str with the given position and count removed")]
|
||||
public static string Remove(string str, int position, int count)
|
||||
{
|
||||
|
@ -115,6 +124,7 @@ namespace BizHawk.Client.Common
|
|||
return str.Remove(position, count);
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( bizstring.contains( \"Some string\", \"Some\") ) then\r\n\tconsole.log( \"Returns whether or not str contains str2\" );\r\nend;")]
|
||||
[LuaMethod("contains", "Returns whether or not str contains str2")]
|
||||
public static bool Contains(string str, string str2)
|
||||
{
|
||||
|
@ -126,6 +136,7 @@ namespace BizHawk.Client.Common
|
|||
return str.Contains(str2);
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( bizstring.startswith( \"Some string\", \"Some\") ) then\r\n\tconsole.log( \"Returns whether str starts with str2\" );\r\nend;")]
|
||||
[LuaMethod("startswith", "Returns whether str starts with str2")]
|
||||
public static bool StartsWith(string str, string str2)
|
||||
{
|
||||
|
@ -137,6 +148,7 @@ namespace BizHawk.Client.Common
|
|||
return str.StartsWith(str2);
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( bizstring.endswith( \"Some string\", \"string\") ) then\r\n\tconsole.log( \"Returns whether str ends wth str2\" );\r\nend;")]
|
||||
[LuaMethod("endswith", "Returns whether str ends wth str2")]
|
||||
public static bool EndsWith(string str, string str2)
|
||||
{
|
||||
|
@ -148,6 +160,7 @@ namespace BizHawk.Client.Common
|
|||
return str.EndsWith(str2);
|
||||
}
|
||||
|
||||
[LuaMethodExample("local nlbizspl = bizstring.split( \"Some, string\", \", \" );")]
|
||||
[LuaMethod("split", "Splits str based on separator into a LuaTable. Separator must be one character!. Same functionality as .NET string.Split() using the RemoveEmptyEntries option")]
|
||||
public LuaTable Split(string str, string separator)
|
||||
{
|
||||
|
|
|
@ -18,9 +18,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public override string Name => "userdata";
|
||||
|
||||
[LuaMethodExample("userdata.set(\"Unique key\", \"Current key data\");")]
|
||||
[LuaMethod("set", "adds or updates the data with the given key with the given value")]
|
||||
public void Set(string name, object value)
|
||||
{
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
var t = value.GetType();
|
||||
|
@ -33,6 +34,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
Global.UserBag[name] = value;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local obuseget = userdata.get( \"Unique key\" );")]
|
||||
[LuaMethod("get", "gets the data with the given key, if the key does not exist it will return nil")]
|
||||
public object Get(string key)
|
||||
{
|
||||
|
@ -44,18 +46,21 @@ namespace BizHawk.Client.EmuHawk
|
|||
return null;
|
||||
}
|
||||
|
||||
[LuaMethodExample("userdata.clear( );")]
|
||||
[LuaMethod("clear", "clears all user data")]
|
||||
public void Clear()
|
||||
{
|
||||
Global.UserBag.Clear();
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( userdata.remove( \"Unique key\" ) ) then\r\n\tconsole.log( \"remove the data with the given key.Returns true if the element is successfully found and removed; otherwise, false.\" );\r\nend;")]
|
||||
[LuaMethod("remove", "remove the data with the given key. Returns true if the element is successfully found and removed; otherwise, false.")]
|
||||
public bool Remove(string key)
|
||||
{
|
||||
return Global.UserBag.Remove(key);
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( userdata.containskey( \"Unique key\" ) ) then\r\n\tconsole.log( \"returns whether or not there is an entry for the given key\" );\r\nend;")]
|
||||
[LuaMethod("containskey", "returns whether or not there is an entry for the given key")]
|
||||
public bool ContainsKey(string key)
|
||||
{
|
||||
|
|
|
@ -15,6 +15,18 @@ namespace BizHawk.Client.Common
|
|||
public string Description { get; }
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
public class LuaMethodExampleAttribute : Attribute
|
||||
{
|
||||
public LuaMethodExampleAttribute(string example)
|
||||
{
|
||||
Example = example;
|
||||
}
|
||||
|
||||
public string Name { get; }
|
||||
public string Example { get; }
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Class)]
|
||||
public class LuaLibraryAttribute : Attribute
|
||||
{
|
||||
|
|
|
@ -162,12 +162,13 @@ __Types and notation__
|
|||
public class LibraryFunction
|
||||
{
|
||||
private readonly LuaMethodAttribute _luaAttributes;
|
||||
private readonly LuaMethodExampleAttribute _luaExampleAttribute;
|
||||
private readonly MethodInfo _method;
|
||||
|
||||
public LibraryFunction(string library, string libraryDescription, MethodInfo method)
|
||||
{
|
||||
_luaAttributes = method.GetCustomAttributes(typeof(LuaMethodAttribute), false)
|
||||
.First() as LuaMethodAttribute;
|
||||
_luaAttributes = method.GetCustomAttribute<LuaMethodAttribute>(false);
|
||||
_luaExampleAttribute = method.GetCustomAttribute<LuaMethodExampleAttribute>(false);
|
||||
_method = method;
|
||||
|
||||
Library = library;
|
||||
|
@ -183,6 +184,8 @@ __Types and notation__
|
|||
|
||||
public string Description => _luaAttributes.Description;
|
||||
|
||||
public string Example => _luaExampleAttribute?.Example;
|
||||
|
||||
private string _paramterList = null;
|
||||
|
||||
public string ParameterList
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
using System;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
public class LuaMethodExample : Attribute
|
||||
{
|
||||
public LuaMethodExample(string name, string example)
|
||||
{
|
||||
Name = name;
|
||||
Example = example;
|
||||
}
|
||||
|
||||
public string Name { get; }
|
||||
public string Example { get; }
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Class)]
|
||||
public class LuaLibraryExample : Attribute
|
||||
{
|
||||
public LuaLibraryExample(bool released)
|
||||
{
|
||||
Released = released;
|
||||
}
|
||||
|
||||
public bool Released { get; }
|
||||
}
|
||||
}
|
|
@ -177,7 +177,7 @@ namespace BizHawk.Client.Common
|
|||
var d = string.IsNullOrEmpty(domain) ? Domain : DomainList[VerifyMemoryDomain(domain)];
|
||||
var lastAddr = length + addr;
|
||||
var table = Lua.NewTable();
|
||||
if (lastAddr < d.Size)
|
||||
if (lastAddr <= d.Size)
|
||||
{
|
||||
for (var i = 0; i < length; i++)
|
||||
{
|
||||
|
|
|
@ -318,7 +318,7 @@ namespace BizHawk.Client.Common
|
|||
if (Movie is TasMovie)
|
||||
{
|
||||
(Movie as TasMovie).GreenzoneCurrentFrame();
|
||||
if (Movie.IsPlaying && Global.Emulator.Frame > Movie.InputLogLength)
|
||||
if (Movie.IsPlaying && Global.Emulator.Frame >= Movie.InputLogLength)
|
||||
{
|
||||
HandleFrameLoopForRecordMode();
|
||||
}
|
||||
|
|
|
@ -143,6 +143,12 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
_myBoolButtons[button] = Global.AutofireStickyXORAdapter.IsSticky(button);
|
||||
}
|
||||
|
||||
// float controls don't have sticky logic. but old values remain in MovieOutputHardpoint if we don't update this here
|
||||
foreach (var name in Definition.FloatControls)
|
||||
{
|
||||
_myFloatControls[name] = Global.AutofireStickyXORAdapter.GetFloat(name);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -20,9 +20,10 @@ namespace BizHawk.Client.Common
|
|||
return;
|
||||
}
|
||||
|
||||
var backupDir = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesBackupsPathFragment, null);
|
||||
var backupName = Filename;
|
||||
backupName = backupName.Insert(Filename.LastIndexOf("."), $".{DateTime.Now:yyyy-MM-dd HH.mm.ss}");
|
||||
backupName = Path.Combine(Global.Config.PathEntries["Global", "Movie backups"].Path, Path.GetFileName(backupName));
|
||||
backupName = Path.Combine(backupDir, Path.GetFileName(backupName));
|
||||
|
||||
var directoryInfo = new FileInfo(backupName).Directory;
|
||||
if (directoryInfo != null)
|
||||
|
|
|
@ -157,7 +157,7 @@ namespace BizHawk.Client.Common.MovieConversionExtensions
|
|||
// States can't be easily moved over, because they contain the frame number.
|
||||
// TODO? I'm not sure how this would be done.
|
||||
tas.TasStateManager.MountWriteAccess();
|
||||
old.TasStateManager.Clear();
|
||||
old.TasStateManager.ClearStateHistory();
|
||||
|
||||
// Lag Log
|
||||
tas.TasLagLog.FromLagLog(old.TasLagLog);
|
||||
|
@ -221,7 +221,7 @@ namespace BizHawk.Client.Common.MovieConversionExtensions
|
|||
}
|
||||
|
||||
var tas = new TasMovie(newFilename, true) { SaveRam = saveRam };
|
||||
tas.TasStateManager.Clear();
|
||||
tas.TasStateManager.ClearStateHistory();
|
||||
tas.ClearLagLog();
|
||||
|
||||
var entries = old.GetLogEntries();
|
||||
|
|
|
@ -121,13 +121,13 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
case 0:
|
||||
case 8:
|
||||
info.Player1Type = OctoshockDll.ePeripheralType.None;
|
||||
info.Player2Type = OctoshockDll.ePeripheralType.None;
|
||||
break;
|
||||
case 4:
|
||||
info.Player1Type = OctoshockDll.ePeripheralType.Pad;
|
||||
info.Player2Type = OctoshockDll.ePeripheralType.Pad;
|
||||
break;
|
||||
case 7:
|
||||
info.Player1Type = OctoshockDll.ePeripheralType.DualShock;
|
||||
info.Player2Type = OctoshockDll.ePeripheralType.DualShock;
|
||||
break;
|
||||
default:
|
||||
Result.Errors.Add("Movie has unrecognised controller type for Player 2.");
|
||||
|
|
|
@ -0,0 +1,203 @@
|
|||
/****************************************************************************************
|
||||
|
||||
Algorithm by r57shell & feos, 2018
|
||||
|
||||
_zeros is the key to GREENZONE DECAY PATTERN.
|
||||
|
||||
In a 16 element example, we evaluate these bitwise numbers to count zeros on the right.
|
||||
First element is always assumed to be 16, which has all 4 bits set to 0. Each right zero
|
||||
means that we lower the priority of a state that goes at that index. Priority changes
|
||||
depending on current frame and amount of states. States with biggest priority get erased
|
||||
first. With a 4-bit battern and no initial gap between states, total frame coverage is
|
||||
about 5 times state count. Initial state gap can screw up our patterns, so do all
|
||||
calculations like gap isn't there, and take it back into account afterwards.
|
||||
|
||||
_zeros values are essentialy the values of rshiftby here:
|
||||
bitwise view frame rshiftby priority
|
||||
00010000 0 4 1
|
||||
00000001 1 0 15
|
||||
00000010 2 1 7
|
||||
00000011 3 0 13
|
||||
00000100 4 2 3
|
||||
00000101 5 0 11
|
||||
00000110 6 1 5
|
||||
00000111 7 0 9
|
||||
00001000 8 3 1
|
||||
00001001 9 0 7
|
||||
00001010 10 1 3
|
||||
00001011 11 0 5
|
||||
00001100 12 2 1
|
||||
00001101 13 0 3
|
||||
00001110 14 1 1
|
||||
00001111 15 0 1
|
||||
|
||||
*****************************************************************************************/
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
internal class StateManagerDecay
|
||||
{
|
||||
private TasStateManager _tsm; // access tsm methods to make life easier
|
||||
private List<int> _zeros; // amount of least significant zeros in bitwise view (also max pattern step)
|
||||
private int _bits; // size of _zeros is 2 raised to the power of _bits
|
||||
private int _mask; // for remainder calculation using bitwise instead of division
|
||||
private int _base; // repeat count (like fceux's capacity). only used by aligned formula
|
||||
private int _capacity; // total amount of savestates
|
||||
private int _step; // initial memory state gap
|
||||
private bool _align; // extra care about fine alignment. TODO: do we want it?
|
||||
|
||||
public StateManagerDecay(TasStateManager tsm)
|
||||
{
|
||||
_tsm = tsm;
|
||||
_align = false;
|
||||
}
|
||||
|
||||
// todo: go through all states once, remove as many as we need. refactor to not need goto
|
||||
public void Trigger(int decayStates)
|
||||
{
|
||||
for (; decayStates > 0 && _tsm.StateCount > 1;)
|
||||
{
|
||||
int baseStateIndex = _tsm.GetStateIndexByFrame(Global.Emulator.Frame);
|
||||
int baseStateFrame = _tsm.GetStateFrameByIndex(baseStateIndex) / _step;
|
||||
int forwardPriority = -1000000;
|
||||
int backwardPriority = -1000000;
|
||||
int forwardFrame = -1;
|
||||
int backwardFrame = -1;
|
||||
|
||||
for (int currentStateIndex = 1; currentStateIndex < baseStateIndex; currentStateIndex++)
|
||||
{
|
||||
int currentFrame = _tsm.GetStateFrameByIndex(currentStateIndex);
|
||||
|
||||
if (_tsm.StateIsMarker(currentFrame))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (currentFrame % _step > 0)
|
||||
{
|
||||
// ignore the pattern if the state doesn't belong already, drop it blindly and skip everything
|
||||
_tsm.RemoveState(currentFrame);
|
||||
decayStates--;
|
||||
|
||||
// this is the kind of highly complex loops that might justify goto
|
||||
goto next_state;
|
||||
}
|
||||
else
|
||||
{
|
||||
currentFrame /= _step;
|
||||
}
|
||||
|
||||
int zeroCount = _zeros[currentFrame & _mask];
|
||||
int priority = ((baseStateFrame - currentFrame) >> zeroCount);
|
||||
|
||||
if (_align)
|
||||
{
|
||||
priority -= ((_base * ((1 << zeroCount) * 2 - 1)) >> zeroCount);
|
||||
}
|
||||
|
||||
if (priority > forwardPriority)
|
||||
{
|
||||
forwardPriority = priority;
|
||||
forwardFrame = currentFrame;
|
||||
}
|
||||
}
|
||||
|
||||
for (int currentStateIndex = _tsm.StateCount - 1; currentStateIndex > baseStateIndex; currentStateIndex--)
|
||||
{
|
||||
int currentFrame = _tsm.GetStateFrameByIndex(currentStateIndex) / _step;
|
||||
|
||||
if (_tsm.StateIsMarker(currentFrame))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (currentFrame % _step > 0)
|
||||
{
|
||||
// ignore the pattern if the state doesn't belong already, drop it blindly and skip everything
|
||||
_tsm.RemoveState(currentFrame);
|
||||
decayStates--;
|
||||
|
||||
// this is the kind of highly complex loops that might justify goto
|
||||
goto next_state;
|
||||
}
|
||||
else
|
||||
{
|
||||
currentFrame /= _step;
|
||||
}
|
||||
|
||||
int zeroCount = _zeros[currentFrame & _mask];
|
||||
int priority = ((currentFrame - baseStateFrame) >> zeroCount);
|
||||
|
||||
if (_align)
|
||||
{
|
||||
priority -= ((_base * ((1 << zeroCount) * 2 - 1)) >> zeroCount);
|
||||
}
|
||||
|
||||
if (priority > backwardPriority)
|
||||
{
|
||||
backwardPriority = priority;
|
||||
backwardFrame = currentFrame;
|
||||
}
|
||||
}
|
||||
|
||||
if (forwardFrame > -1 && backwardFrame > -1)
|
||||
{
|
||||
if (baseStateFrame - forwardFrame > backwardFrame - baseStateFrame)
|
||||
{
|
||||
_tsm.RemoveState(forwardFrame * _step);
|
||||
}
|
||||
else
|
||||
{
|
||||
_tsm.RemoveState(backwardFrame * _step);
|
||||
}
|
||||
|
||||
decayStates--;
|
||||
}
|
||||
else if (forwardFrame > -1)
|
||||
{
|
||||
_tsm.RemoveState(forwardFrame * _step);
|
||||
decayStates--;
|
||||
}
|
||||
else if (backwardFrame > -1)
|
||||
{
|
||||
_tsm.RemoveState(backwardFrame * _step);
|
||||
decayStates--;
|
||||
}
|
||||
else
|
||||
{
|
||||
// we're very sorry about failing to find states to remove, but we can't go beyond capacity, so remove at least something
|
||||
// this shouldn't happen, but if we don't do it here, nothing good will happen either
|
||||
_tsm.RemoveState(_tsm.GetStateFrameByIndex(1));
|
||||
}
|
||||
|
||||
// this is the kind of highly complex loops that might justify goto
|
||||
next_state:;
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateSettings(int capacity, int step, int bits)
|
||||
{
|
||||
_capacity = capacity;
|
||||
_step = step;
|
||||
_bits = bits;
|
||||
_mask = (1 << _bits) - 1;
|
||||
_base = (_capacity + _bits / 2) / (_bits + 1);
|
||||
_zeros = new List<int>();
|
||||
_zeros.Add(_bits);
|
||||
|
||||
for (int i = 1; i < (1 << _bits); i++)
|
||||
{
|
||||
_zeros.Add(0);
|
||||
|
||||
for (int j = i; j > 0; j >>= 1)
|
||||
{
|
||||
if ((j & 1) > 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
_zeros[i]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -372,7 +372,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
|
||||
Changes = true;
|
||||
InvalidateAfter(frame - 1);
|
||||
InvalidateAfter(frame);
|
||||
|
||||
ChangeLog.SetGeneralRedo();
|
||||
if (endBatch)
|
||||
|
|
|
@ -62,15 +62,11 @@ namespace BizHawk.Client.Common
|
|||
if (Branches.Any())
|
||||
{
|
||||
Branches.Save(bs);
|
||||
if (_stateManager.Settings.BranchStatesInTasproj)
|
||||
{
|
||||
bs.PutLump(BinaryStateLump.BranchStateHistory, (BinaryWriter bw) => _stateManager.SaveBranchStates(bw));
|
||||
}
|
||||
}
|
||||
|
||||
bs.PutLump(BinaryStateLump.Session, tw => tw.WriteLine(Session.ToString()));
|
||||
|
||||
if (_stateManager.Settings.SaveStateHistory)
|
||||
if (_stateManager.Settings.SaveStateHistory && !backup)
|
||||
{
|
||||
bs.PutLump(BinaryStateLump.StateHistory, (BinaryWriter bw) => _stateManager.Save(bw));
|
||||
}
|
||||
|
@ -245,13 +241,6 @@ namespace BizHawk.Client.Common
|
|||
});
|
||||
|
||||
Branches.Load(bl, this);
|
||||
if (_stateManager.Settings.BranchStatesInTasproj)
|
||||
{
|
||||
bl.GetLump(BinaryStateLump.BranchStateHistory, false, delegate(BinaryReader br, long length)
|
||||
{
|
||||
_stateManager.LoadBranchStates(br);
|
||||
});
|
||||
}
|
||||
|
||||
bl.GetLump(BinaryStateLump.Session, false, delegate(TextReader tr)
|
||||
{
|
||||
|
@ -283,7 +272,7 @@ namespace BizHawk.Client.Common
|
|||
private void ClearTasprojExtras()
|
||||
{
|
||||
_lagLog.Clear();
|
||||
_stateManager.Clear();
|
||||
_stateManager.ClearStateHistory();
|
||||
Markers.Clear();
|
||||
ChangeLog.ClearLog();
|
||||
}
|
||||
|
|
|
@ -16,29 +16,24 @@ namespace BizHawk.Client.Common
|
|||
private readonly TasStateManager _stateManager;
|
||||
private readonly TasLagLog _lagLog = new TasLagLog();
|
||||
private readonly Dictionary<int, IController> _inputStateCache = new Dictionary<int, IController>();
|
||||
|
||||
private BackgroundWorker _progressReportWorker;
|
||||
|
||||
public new const string Extension = "tasproj";
|
||||
public const string DefaultProjectName = "default";
|
||||
|
||||
public bool LastPositionStable { get; set; } = true;
|
||||
public string NewBranchText { get; set; } = "";
|
||||
|
||||
public readonly IStringLog VerificationLog = StringLogUtil.MakeStringLog(); // For movies that do not begin with power-on, this is the input required to get into the initial state
|
||||
public readonly TasBranchCollection Branches = new TasBranchCollection();
|
||||
public readonly TasSession Session;
|
||||
|
||||
public TasLagLog TasLagLog => _lagLog;
|
||||
|
||||
public IStringLog InputLog => Log;
|
||||
|
||||
public new const string Extension = "tasproj";
|
||||
public const string DefaultProjectName = "default";
|
||||
public string NewBranchText { get; set; } = "";
|
||||
public int LastEditedFrame { get; set; } = -1;
|
||||
public bool LastPositionStable { get; set; } = true;
|
||||
public TasMovieMarkerList Markers { get; private set; }
|
||||
|
||||
public bool BindMarkersToInput { get; set; }
|
||||
public bool UseInputCache { get; set; }
|
||||
public int CurrentBranch { get; set; }
|
||||
|
||||
public TasLagLog TasLagLog => _lagLog;
|
||||
public IStringLog InputLog => Log;
|
||||
public int BranchCount => Branches.Count;
|
||||
public int LastValidFrame => _lagLog.LastValidFrame;
|
||||
public override string PreferredExtension => Extension;
|
||||
|
@ -155,7 +150,8 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
var anyInvalidated = _lagLog.RemoveFrom(frame);
|
||||
_stateManager.Invalidate(frame + 1);
|
||||
Changes = true; // TODO check if this actually removed anything before flagging changes
|
||||
Changes = anyInvalidated;
|
||||
LastEditedFrame = frame;
|
||||
|
||||
if (anyInvalidated && Global.MovieSession.Movie.IsCountingRerecords)
|
||||
{
|
||||
|
@ -239,7 +235,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
if (!_stateManager.HasState(Global.Emulator.Frame))
|
||||
{
|
||||
_stateManager.Capture();
|
||||
_stateManager.Capture(Global.Emulator.Frame == LastEditedFrame - 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -497,13 +493,11 @@ namespace BizHawk.Client.Common
|
|||
public void AddBranch(TasBranch branch)
|
||||
{
|
||||
Branches.Add(branch);
|
||||
TasStateManager.AddBranch();
|
||||
Changes = true;
|
||||
}
|
||||
|
||||
public void RemoveBranch(TasBranch branch)
|
||||
{
|
||||
TasStateManager.RemoveBranch(Branches.IndexOf(branch));
|
||||
Branches.Remove(branch);
|
||||
Changes = true;
|
||||
}
|
||||
|
@ -527,9 +521,6 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
_stateManager.Invalidate(branch.InputLog.Count);
|
||||
}
|
||||
|
||||
_stateManager.LoadBranch(Branches.IndexOf(branch));
|
||||
_stateManager.SetState(branch.Frame, branch.CoreData);
|
||||
|
||||
if (BindMarkersToInput) // pretty critical not to erase them
|
||||
{
|
||||
|
@ -549,7 +540,6 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
|
||||
Branches[index] = newBranch;
|
||||
TasStateManager.UpdateBranch(index);
|
||||
Changes = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ using System.Linq;
|
|||
using System.Drawing;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Common.NumberExtensions;
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Emulation.Common.IEmulatorExtensions;
|
||||
|
||||
|
@ -26,7 +27,6 @@ namespace BizHawk.Client.Common
|
|||
InvalidateCallback?.Invoke(index);
|
||||
}
|
||||
|
||||
private readonly List<StateManagerState> _lowPriorityStates = new List<StateManagerState>();
|
||||
internal NDBDatabase NdbDatabase { get; set; }
|
||||
private Guid _guid = Guid.NewGuid();
|
||||
private SortedList<int, StateManagerState> _states = new SortedList<int, StateManagerState>();
|
||||
|
@ -42,47 +42,27 @@ namespace BizHawk.Client.Common
|
|||
|
||||
private bool _isMountedForWrite;
|
||||
private readonly TasMovie _movie;
|
||||
|
||||
private StateManagerDecay _decay;
|
||||
private ulong _expectedStateSize;
|
||||
|
||||
private readonly int _minFrequency = VersionInfo.DeveloperBuild ? 2 : 1;
|
||||
private const int MaxFrequency = 16;
|
||||
|
||||
private int StateFrequency
|
||||
{
|
||||
get
|
||||
{
|
||||
int freq = (int)(_expectedStateSize / 65536);
|
||||
|
||||
if (freq < _minFrequency)
|
||||
{
|
||||
return _minFrequency;
|
||||
}
|
||||
|
||||
if (freq > MaxFrequency)
|
||||
{
|
||||
return MaxFrequency;
|
||||
}
|
||||
|
||||
return freq;
|
||||
}
|
||||
}
|
||||
|
||||
private int MaxStates => (int)(Settings.Cap / _expectedStateSize) + (int)((ulong)Settings.DiskCapacitymb * 1024 * 1024 / _expectedStateSize);
|
||||
|
||||
private int StateGap => 1 << Settings.StateGap;
|
||||
private int _stateFrequency;
|
||||
private readonly int _minFrequency = 1;
|
||||
private readonly int _maxFrequency = 16;
|
||||
private int _maxStates => (int)(Settings.Cap / _expectedStateSize) +
|
||||
(int)((ulong)Settings.DiskCapacitymb * 1024 * 1024 / _expectedStateSize);
|
||||
private int _fileStateGap => 1 << Settings.FileStateGap;
|
||||
|
||||
public TasStateManager(TasMovie movie)
|
||||
{
|
||||
_movie = movie;
|
||||
|
||||
Settings = new TasStateManagerSettings(Global.Config.DefaultTasProjSettings);
|
||||
|
||||
_accessed = new List<StateManagerState>();
|
||||
|
||||
if (_movie.StartsFromSavestate)
|
||||
{
|
||||
SetState(0, _movie.BinarySavestate);
|
||||
}
|
||||
|
||||
_decay = new StateManagerDecay(this);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
@ -91,6 +71,15 @@ namespace BizHawk.Client.Common
|
|||
NdbDatabase?.Dispose();
|
||||
}
|
||||
|
||||
public void UpdateStateFrequency()
|
||||
{
|
||||
_stateFrequency = NumberExtensions.Clamp(
|
||||
((int)_expectedStateSize / Settings.MemStateGapDivider / 1024),
|
||||
_minFrequency, _maxFrequency);
|
||||
|
||||
_decay.UpdateSettings(_maxStates, _stateFrequency, 4);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Mounts this instance for write access. Prior to that it's read-only
|
||||
/// </summary>
|
||||
|
@ -101,15 +90,14 @@ namespace BizHawk.Client.Common
|
|||
return;
|
||||
}
|
||||
|
||||
_isMountedForWrite = true;
|
||||
|
||||
int limit = 0;
|
||||
|
||||
_isMountedForWrite = true;
|
||||
_expectedStateSize = (ulong)Core.SaveStateBinary().Length;
|
||||
UpdateStateFrequency();
|
||||
|
||||
if (_expectedStateSize > 0)
|
||||
{
|
||||
limit = MaxStates;
|
||||
limit = _maxStates;
|
||||
}
|
||||
|
||||
_states = new SortedList<int, StateManagerState>(limit);
|
||||
|
@ -121,7 +109,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
NdbDatabase = new NDBDatabase(StatePath, Settings.DiskCapacitymb * 1024 * 1024, (int)_expectedStateSize);
|
||||
}
|
||||
|
||||
|
||||
public TasStateManagerSettings Settings { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -140,7 +128,6 @@ namespace BizHawk.Client.Common
|
|||
|
||||
if (_states.ContainsKey(frame))
|
||||
{
|
||||
StateAccessed(frame);
|
||||
return new KeyValuePair<int, byte[]>(frame, _states[frame].State);
|
||||
}
|
||||
|
||||
|
@ -148,8 +135,6 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
|
||||
private readonly List<StateManagerState> _accessed;
|
||||
|
||||
public byte[] InitialState
|
||||
{
|
||||
get
|
||||
|
@ -170,8 +155,8 @@ namespace BizHawk.Client.Common
|
|||
public void Capture(bool force = false)
|
||||
{
|
||||
bool shouldCapture;
|
||||
|
||||
int frame = Global.Emulator.Frame;
|
||||
|
||||
if (_movie.StartsFromSavestate && frame == 0) // Never capture frame 0 on savestate anchored movies since we have it anyway
|
||||
{
|
||||
shouldCapture = false;
|
||||
|
@ -184,13 +169,13 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
shouldCapture = true;
|
||||
}
|
||||
else if (_movie.Markers.IsMarker(frame + 1))
|
||||
else if (StateIsMarker(frame))
|
||||
{
|
||||
shouldCapture = true; // Markers shoudl always get priority
|
||||
}
|
||||
else
|
||||
{
|
||||
shouldCapture = frame % StateFrequency == 0;
|
||||
shouldCapture = frame % _stateFrequency == 0;
|
||||
}
|
||||
|
||||
if (shouldCapture)
|
||||
|
@ -199,159 +184,6 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
|
||||
private void MaybeRemoveStates()
|
||||
{
|
||||
// Loop, because removing a state that has a duplicate won't save any space
|
||||
while (Used + _expectedStateSize > Settings.Cap || DiskUsed > (ulong)Settings.DiskCapacitymb * 1024 * 1024)
|
||||
{
|
||||
Point shouldRemove = StateToRemove();
|
||||
RemoveState(shouldRemove.X, shouldRemove.Y);
|
||||
}
|
||||
|
||||
if (Used > Settings.Cap)
|
||||
{
|
||||
int lastMemState = -1;
|
||||
do
|
||||
{
|
||||
lastMemState++;
|
||||
}
|
||||
while (_states[_accessed[lastMemState].Frame] == null);
|
||||
MoveStateToDisk(_accessed[lastMemState].Frame);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// X is the frame of the state, Y is the branch (-1 for current).
|
||||
/// </summary>
|
||||
private Point StateToRemove()
|
||||
{
|
||||
// X is frame, Y is branch
|
||||
Point shouldRemove = new Point(-1, -1);
|
||||
|
||||
if (_branchStates.Any() && Settings.EraseBranchStatesFirst)
|
||||
{
|
||||
var kvp = _branchStates.Count > 1 ? _branchStates.ElementAt(1) : _branchStates.ElementAt(0);
|
||||
shouldRemove.X = kvp.Key;
|
||||
shouldRemove.Y = kvp.Value.Keys[0];
|
||||
|
||||
return shouldRemove;
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
int markerSkips = MaxStates / 2;
|
||||
|
||||
// lowPrioritySates (e.g. states with only lag frames between them)
|
||||
do
|
||||
{
|
||||
if (_lowPriorityStates.Count > i)
|
||||
{
|
||||
shouldRemove = FindState(_lowPriorityStates[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// Keep marker states
|
||||
markerSkips--;
|
||||
if (markerSkips < 0)
|
||||
{
|
||||
shouldRemove.X = -1;
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
while ((StateIsMarker(shouldRemove.X, shouldRemove.Y) && markerSkips > -1) || shouldRemove.X == 0);
|
||||
|
||||
// by last accessed
|
||||
markerSkips = MaxStates / 2;
|
||||
if (shouldRemove.X < 1)
|
||||
{
|
||||
i = 0;
|
||||
do
|
||||
{
|
||||
if (_accessed.Count > i)
|
||||
{
|
||||
shouldRemove = FindState(_accessed[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// Keep marker states
|
||||
markerSkips--;
|
||||
if (markerSkips < 0)
|
||||
{
|
||||
shouldRemove.X = -1;
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
while ((StateIsMarker(shouldRemove.X, shouldRemove.Y) && markerSkips > -1) || shouldRemove.X == 0);
|
||||
}
|
||||
|
||||
if (shouldRemove.X < 1) // only found marker states above
|
||||
{
|
||||
if (_branchStates.Any() && !Settings.EraseBranchStatesFirst)
|
||||
{
|
||||
var kvp = _branchStates.Count > 1 ? _branchStates.ElementAt(1) : _branchStates.ElementAt(0);
|
||||
shouldRemove.X = kvp.Key;
|
||||
shouldRemove.Y = kvp.Value.Keys[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
StateManagerState s = _states.Values[1];
|
||||
shouldRemove.X = s.Frame;
|
||||
shouldRemove.Y = -1;
|
||||
}
|
||||
}
|
||||
|
||||
return shouldRemove;
|
||||
}
|
||||
|
||||
private bool StateIsMarker(int frame, int branch)
|
||||
{
|
||||
if (frame == -1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (branch == -1)
|
||||
{
|
||||
return _movie.Markers.IsMarker(_states[frame].Frame + 1);
|
||||
}
|
||||
|
||||
if (_movie.GetBranch(_movie.BranchIndexByHash(branch)).Markers == null)
|
||||
{
|
||||
return _movie.Markers.IsMarker(_states[frame].Frame + 1);
|
||||
}
|
||||
|
||||
return _movie.GetBranch(branch).Markers.Any(m => m.Frame + 1 == frame);
|
||||
}
|
||||
|
||||
private bool AllLag(int from, int upTo)
|
||||
{
|
||||
if (upTo >= Global.Emulator.Frame)
|
||||
{
|
||||
upTo = Global.Emulator.Frame - 1;
|
||||
if (!Global.Emulator.AsInputPollable().IsLagFrame)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = from; i < upTo; i++)
|
||||
{
|
||||
if (_movie[i].Lagged == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void MoveStateToDisk(int index)
|
||||
{
|
||||
Used -= (ulong)_states[index].Length;
|
||||
|
@ -368,16 +200,11 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
if (!skipRemoval) // skipRemoval: false only when capturing new states
|
||||
{
|
||||
MaybeRemoveStates(); // Remove before adding so this state won't be removed.
|
||||
LimitStateCount(); // Remove before adding so this state won't be removed.
|
||||
}
|
||||
|
||||
if (_states.ContainsKey(frame))
|
||||
{
|
||||
if (StateHasDuplicate(frame, -1) != -2)
|
||||
{
|
||||
Used += (ulong)state.Length;
|
||||
}
|
||||
|
||||
_states[frame].State = state;
|
||||
}
|
||||
else
|
||||
|
@ -385,91 +212,6 @@ namespace BizHawk.Client.Common
|
|||
Used += (ulong)state.Length;
|
||||
_states.Add(frame, new StateManagerState(this, state, frame));
|
||||
}
|
||||
|
||||
StateAccessed(frame);
|
||||
|
||||
int i = _states.IndexOfKey(frame);
|
||||
if (i > 0 && AllLag(_states.Keys[i - 1], _states.Keys[i]))
|
||||
{
|
||||
_lowPriorityStates.Add(_states[frame]);
|
||||
}
|
||||
}
|
||||
|
||||
private void RemoveState(int frame, int branch = -1)
|
||||
{
|
||||
if (branch == -1)
|
||||
{
|
||||
_accessed.Remove(_states[frame]);
|
||||
}
|
||||
else if (_accessed.Contains(_branchStates[frame][branch]) && !Settings.EraseBranchStatesFirst)
|
||||
{
|
||||
_accessed.Remove(_branchStates[frame][branch]);
|
||||
}
|
||||
|
||||
StateManagerState state;
|
||||
bool hasDuplicate = StateHasDuplicate(frame, branch) != -2;
|
||||
if (branch == -1)
|
||||
{
|
||||
state = _states[frame];
|
||||
if (_states[frame].IsOnDisk)
|
||||
{
|
||||
_states[frame].Dispose();
|
||||
}
|
||||
else
|
||||
{
|
||||
Used -= (ulong)_states[frame].Length;
|
||||
}
|
||||
|
||||
_states.RemoveAt(_states.IndexOfKey(frame));
|
||||
}
|
||||
else
|
||||
{
|
||||
state = _branchStates[frame][branch];
|
||||
|
||||
if (_branchStates[frame][branch].IsOnDisk)
|
||||
{
|
||||
_branchStates[frame][branch].Dispose();
|
||||
}
|
||||
|
||||
_branchStates[frame].RemoveAt(_branchStates[frame].IndexOfKey(branch));
|
||||
|
||||
if (_branchStates[frame].Count == 0)
|
||||
{
|
||||
_branchStates.Remove(frame);
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasDuplicate)
|
||||
{
|
||||
_lowPriorityStates.Remove(state);
|
||||
}
|
||||
}
|
||||
|
||||
private void StateAccessed(int frame)
|
||||
{
|
||||
if (frame == 0 && _movie.StartsFromSavestate)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
StateManagerState state = _states[frame];
|
||||
bool removed = _accessed.Remove(state);
|
||||
_accessed.Add(state);
|
||||
|
||||
if (_states[frame].IsOnDisk)
|
||||
{
|
||||
if (!_states[_accessed[0].Frame].IsOnDisk)
|
||||
{
|
||||
MoveStateToDisk(_accessed[0].Frame);
|
||||
}
|
||||
|
||||
MoveStateToMemory(frame);
|
||||
}
|
||||
|
||||
if (!removed && _accessed.Count > MaxStates)
|
||||
{
|
||||
_accessed.RemoveAt(0);
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasState(int frame)
|
||||
|
@ -491,14 +233,12 @@ namespace BizHawk.Client.Common
|
|||
|
||||
if (Any())
|
||||
{
|
||||
if (!_movie.StartsFromSavestate && frame == 0) // Never invalidate frame 0 on a non-savestate-anchored movie
|
||||
if (frame == 0) // Never invalidate frame 0
|
||||
{
|
||||
frame = 1;
|
||||
}
|
||||
|
||||
List<KeyValuePair<int, StateManagerState>> statesToRemove =
|
||||
_states.Where(s => s.Key >= frame).ToList();
|
||||
|
||||
List<KeyValuePair<int, StateManagerState>> statesToRemove = _states.Where(s => s.Key >= frame).ToList();
|
||||
anyInvalidated = statesToRemove.Any();
|
||||
|
||||
foreach (var state in statesToRemove)
|
||||
|
@ -512,66 +252,48 @@ namespace BizHawk.Client.Common
|
|||
return anyInvalidated;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears all state information
|
||||
/// </summary>
|
||||
public void Clear()
|
||||
public bool StateIsMarker(int frame)
|
||||
{
|
||||
_states.Clear();
|
||||
_accessed.Clear();
|
||||
Used = 0;
|
||||
ClearDiskStates();
|
||||
}
|
||||
|
||||
public void ClearStateHistory()
|
||||
{
|
||||
if (_states.Any())
|
||||
if (frame == -1)
|
||||
{
|
||||
StateManagerState power = _states.Values.First(s => s.Frame == 0);
|
||||
StateAccessed(power.Frame);
|
||||
|
||||
_states.Clear();
|
||||
_accessed.Clear();
|
||||
|
||||
SetState(0, power.State);
|
||||
Used = (ulong)power.State.Length;
|
||||
|
||||
ClearDiskStates();
|
||||
return false;
|
||||
}
|
||||
|
||||
return _movie.Markers.IsMarker(frame + 1);
|
||||
}
|
||||
|
||||
private void ClearDiskStates()
|
||||
public void RemoveState(int frame)
|
||||
{
|
||||
NdbDatabase?.Clear();
|
||||
int index = _states.IndexOfKey(frame);
|
||||
|
||||
if (frame < 1 || index < 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
StateManagerState state = _states.ElementAt(index).Value;
|
||||
|
||||
if (state.IsOnDisk)
|
||||
{
|
||||
state.Dispose();
|
||||
}
|
||||
else
|
||||
{
|
||||
Used -= (ulong)state.Length;
|
||||
}
|
||||
|
||||
_states.RemoveAt(index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes/moves states to follow the state storage size limits.
|
||||
/// Used after changing the settings.
|
||||
/// Deletes states to follow the state storage size limits.
|
||||
/// Used after changing the settings too.
|
||||
/// </summary>
|
||||
public void LimitStateCount()
|
||||
{
|
||||
while (Used + DiskUsed > Settings.CapTotal)
|
||||
if (StateCount + 1 > _maxStates || DiskUsed > (ulong)Settings.DiskCapacitymb * 1024 * 1024)
|
||||
{
|
||||
Point s = StateToRemove();
|
||||
RemoveState(s.X, s.Y);
|
||||
}
|
||||
|
||||
int index = -1;
|
||||
while (DiskUsed > (ulong)Settings.DiskCapacitymb * 1024uL * 1024uL)
|
||||
{
|
||||
do
|
||||
{
|
||||
index++;
|
||||
}
|
||||
while (!_accessed[index].IsOnDisk);
|
||||
|
||||
_accessed[index].MoveToRAM();
|
||||
}
|
||||
|
||||
if (Used > Settings.Cap)
|
||||
{
|
||||
MaybeRemoveStates();
|
||||
_decay.Trigger(StateCount + 1 - _maxStates);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -584,21 +306,22 @@ namespace BizHawk.Client.Common
|
|||
// still leave marker states
|
||||
for (int i = 1; i < _states.Count; i++)
|
||||
{
|
||||
if (_movie.Markers.IsMarker(_states.ElementAt(i).Key + 1)
|
||||
|| _states.ElementAt(i).Key % StateGap == 0)
|
||||
int frame = GetStateFrameByIndex(i);
|
||||
|
||||
if (StateIsMarker(frame) || frame % _fileStateGap < _stateFrequency)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ret.Add(i);
|
||||
|
||||
if (_states.ElementAt(i).Value.IsOnDisk)
|
||||
if (_states.Values[i].IsOnDisk)
|
||||
{
|
||||
saveUsed -= _expectedStateSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
saveUsed -= (ulong)_states.ElementAt(i).Value.Length;
|
||||
saveUsed -= (ulong)_states.Values[i].Length;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -609,13 +332,12 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
do
|
||||
{
|
||||
index++;
|
||||
if (index >= _states.Count)
|
||||
if (++index >= _states.Count)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (_movie.Markers.IsMarker(_states.ElementAt(index).Key + 1));
|
||||
while (StateIsMarker(GetStateFrameByIndex(index)));
|
||||
|
||||
if (index >= _states.Count)
|
||||
{
|
||||
|
@ -624,13 +346,13 @@ namespace BizHawk.Client.Common
|
|||
|
||||
ret.Add(index);
|
||||
|
||||
if (_states.ElementAt(index).Value.IsOnDisk)
|
||||
if (_states.Values[index].IsOnDisk)
|
||||
{
|
||||
saveUsed -= _expectedStateSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
saveUsed -= (ulong)_states.ElementAt(index).Value.Length;
|
||||
saveUsed -= (ulong)_states.Values[index].Length;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -638,30 +360,47 @@ namespace BizHawk.Client.Common
|
|||
index = 0;
|
||||
while (saveUsed > (ulong)Settings.DiskSaveCapacitymb * 1024 * 1024)
|
||||
{
|
||||
index++;
|
||||
if (!ret.Contains(index))
|
||||
if (!ret.Contains(++index))
|
||||
{
|
||||
ret.Add(index);
|
||||
}
|
||||
|
||||
if (_states.ElementAt(index).Value.IsOnDisk)
|
||||
if (_states.Values[index].IsOnDisk)
|
||||
{
|
||||
saveUsed -= _expectedStateSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
saveUsed -= (ulong)_states.ElementAt(index).Value.Length;
|
||||
saveUsed -= (ulong)_states.Values[index].Length;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void ClearStateHistory()
|
||||
{
|
||||
if (_states.Any())
|
||||
{
|
||||
StateManagerState power = _states.Values.First(s => s.Frame == 0);
|
||||
_states.Clear();
|
||||
SetState(0, power.State);
|
||||
Used = (ulong)power.State.Length;
|
||||
NdbDatabase?.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
// Map:
|
||||
// 4 bytes - total savestate count
|
||||
// [Foreach state]
|
||||
// 4 bytes - frame
|
||||
// 4 bytes - length of savestate
|
||||
// 0 - n savestate
|
||||
public void Save(BinaryWriter bw)
|
||||
{
|
||||
List<int> noSave = ExcludeStates();
|
||||
|
||||
bw.Write(_states.Count - noSave.Count);
|
||||
|
||||
for (int i = 0; i < _states.Count; i++)
|
||||
{
|
||||
if (noSave.Contains(i))
|
||||
|
@ -669,21 +408,21 @@ namespace BizHawk.Client.Common
|
|||
continue;
|
||||
}
|
||||
|
||||
StateAccessed(_states.ElementAt(i).Key);
|
||||
KeyValuePair<int, StateManagerState> kvp = _states.ElementAt(i);
|
||||
bw.Write(kvp.Key);
|
||||
bw.Write(kvp.Value.Length);
|
||||
bw.Write(kvp.Value.State);
|
||||
////_movie.ReportProgress(100d / States.Count * i);
|
||||
}
|
||||
}
|
||||
|
||||
public void Load(BinaryReader br)
|
||||
{
|
||||
_states.Clear();
|
||||
|
||||
try
|
||||
{
|
||||
int nstates = br.ReadInt32();
|
||||
|
||||
for (int i = 0; i < nstates; i++)
|
||||
{
|
||||
int frame = br.ReadInt32();
|
||||
|
@ -693,8 +432,6 @@ namespace BizHawk.Client.Common
|
|||
// whether we should allow state removal check here is an interesting question
|
||||
// nothing was edited yet, so it might make sense to show the project untouched first
|
||||
SetState(frame, data);
|
||||
////States.Add(frame, data);
|
||||
////Used += len;
|
||||
}
|
||||
}
|
||||
catch (EndOfStreamException)
|
||||
|
@ -702,50 +439,6 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
|
||||
public void SaveBranchStates(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(_branchStates.Count);
|
||||
foreach (var s in _branchStates)
|
||||
{
|
||||
bw.Write(s.Key);
|
||||
bw.Write(s.Value.Count);
|
||||
foreach (var t in s.Value)
|
||||
{
|
||||
bw.Write(t.Key);
|
||||
t.Value.Write(bw);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadBranchStates(BinaryReader br)
|
||||
{
|
||||
try
|
||||
{
|
||||
int c = br.ReadInt32();
|
||||
_branchStates = new SortedList<int, SortedList<int, StateManagerState>>(c);
|
||||
while (c > 0)
|
||||
{
|
||||
int key = br.ReadInt32();
|
||||
int c2 = br.ReadInt32();
|
||||
var list = new SortedList<int, StateManagerState>(c2);
|
||||
while (c2 > 0)
|
||||
{
|
||||
int key2 = br.ReadInt32();
|
||||
var state = StateManagerState.Read(br, this);
|
||||
list.Add(key2, state);
|
||||
c2--;
|
||||
}
|
||||
|
||||
_branchStates.Add(key, list);
|
||||
c--;
|
||||
}
|
||||
}
|
||||
catch (EndOfStreamException)
|
||||
{
|
||||
// Bad!
|
||||
}
|
||||
}
|
||||
|
||||
public KeyValuePair<int, byte[]> GetStateClosestToFrame(int frame)
|
||||
{
|
||||
var s = _states.LastOrDefault(state => state.Key < frame);
|
||||
|
@ -753,12 +446,28 @@ namespace BizHawk.Client.Common
|
|||
return this[s.Key];
|
||||
}
|
||||
|
||||
// Map:
|
||||
// 4 bytes - total savestate count
|
||||
// [Foreach state]
|
||||
// 4 bytes - frame
|
||||
// 4 bytes - length of savestate
|
||||
// 0 - n savestate
|
||||
/// <summary>
|
||||
/// Returns index of the state right above the given frame
|
||||
/// </summary>
|
||||
/// <param name="frame"></param>
|
||||
/// <returns></returns>
|
||||
public int GetStateIndexByFrame(int frame)
|
||||
{
|
||||
return _states.IndexOfKey(GetStateClosestToFrame(frame).Key);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns frame of the state at the given index
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <returns></returns>
|
||||
public int GetStateFrameByIndex(int index)
|
||||
{
|
||||
// feos: this is called super often by decay
|
||||
// this method is hundred times faster than _states.ElementAt(index).Key
|
||||
return _states.Keys[index];
|
||||
}
|
||||
|
||||
private ulong _used;
|
||||
private ulong Used
|
||||
{
|
||||
|
@ -819,7 +528,7 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
|
||||
public int LastEmulatedFrame
|
||||
public int LastStatedFrame
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -832,219 +541,14 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
|
||||
#region Branches
|
||||
|
||||
private SortedList<int, SortedList<int, StateManagerState>> _branchStates = new SortedList<int, SortedList<int, StateManagerState>>();
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the state at frame in the given branch (-1 for current) has any duplicates.
|
||||
/// </summary>
|
||||
/// <returns>Index of the branch (-1 for current) of the first match. If no match, returns -2.</returns>
|
||||
private int StateHasDuplicate(int frame, int branchHash)
|
||||
private int FindState(StateManagerState s)
|
||||
{
|
||||
StateManagerState stateToMatch;
|
||||
|
||||
// Get the state instance
|
||||
if (branchHash == -1)
|
||||
{
|
||||
stateToMatch = _states[frame];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!_branchStates[frame].ContainsKey(branchHash))
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
|
||||
stateToMatch = _branchStates[frame][branchHash];
|
||||
|
||||
// Check the current branch for duplicate.
|
||||
if (_states.ContainsKey(frame) && _states[frame] == stateToMatch)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if there are any branch states for the given frame.
|
||||
if (!_branchStates.ContainsKey(frame) || _branchStates[frame] == null || branchHash == -1)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
|
||||
// Loop through branch states for the given frame.
|
||||
SortedList<int, StateManagerState> stateList = _branchStates[frame];
|
||||
for (int i = 0; i < stateList.Count; i++)
|
||||
{
|
||||
// Don't check the branch containing the state to match.
|
||||
if (i == _movie.BranchIndexByHash(branchHash))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (stateList.Values[i] == stateToMatch)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -2; // No match.
|
||||
}
|
||||
|
||||
private Point FindState(StateManagerState s)
|
||||
{
|
||||
Point ret = new Point(0, -1);
|
||||
ret.X = s.Frame;
|
||||
if (!_states.ContainsValue(s))
|
||||
{
|
||||
if (_branchStates.ContainsKey(s.Frame))
|
||||
{
|
||||
int index = _branchStates[s.Frame].Values.IndexOf(s);
|
||||
ret.Y = _branchStates[s.Frame].Keys.ElementAt(index);
|
||||
}
|
||||
|
||||
if (ret.Y == -1)
|
||||
{
|
||||
return new Point(-1, -2);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ret;
|
||||
return s.Frame;
|
||||
}
|
||||
|
||||
public void AddBranch()
|
||||
{
|
||||
int branchHash = _movie.BranchHashByIndex(_movie.BranchCount - 1);
|
||||
|
||||
foreach (KeyValuePair<int, StateManagerState> kvp in _states)
|
||||
{
|
||||
if (!_branchStates.ContainsKey(kvp.Key))
|
||||
{
|
||||
_branchStates.Add(kvp.Key, new SortedList<int, StateManagerState>());
|
||||
}
|
||||
|
||||
SortedList<int, StateManagerState> stateList = _branchStates[kvp.Key];
|
||||
|
||||
if (stateList == null) // when does this happen?
|
||||
{
|
||||
stateList = new SortedList<int, StateManagerState>();
|
||||
_branchStates[kvp.Key] = stateList;
|
||||
}
|
||||
|
||||
// We aren't creating any new states, just adding a reference to an already-existing one; so Used doesn't need to be updated.
|
||||
stateList.Add(branchHash, kvp.Value);
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveBranch(int index)
|
||||
{
|
||||
int branchHash = _movie.BranchHashByIndex(index);
|
||||
|
||||
foreach (KeyValuePair<int, SortedList<int, StateManagerState>> kvp in _branchStates.ToList())
|
||||
{
|
||||
SortedList<int, StateManagerState> stateList = kvp.Value;
|
||||
if (stateList == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
if (stateList.ContainsKey(branchHash))
|
||||
{
|
||||
if (stateHasDuplicate(kvp.Key, branchHash) == -2)
|
||||
{
|
||||
if (!stateList[branchHash].IsOnDisk)
|
||||
Used -= (ulong)stateList[branchHash].Length;
|
||||
}
|
||||
}
|
||||
*/
|
||||
stateList.Remove(branchHash);
|
||||
if (stateList.Count == 0)
|
||||
{
|
||||
_branchStates.Remove(kvp.Key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateBranch(int index)
|
||||
{
|
||||
if (index == -1) // backup branch is outsider
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int branchHash = _movie.BranchHashByIndex(index);
|
||||
|
||||
// RemoveBranch
|
||||
foreach (KeyValuePair<int, SortedList<int, StateManagerState>> kvp in _branchStates.ToList())
|
||||
{
|
||||
SortedList<int, StateManagerState> stateList = kvp.Value;
|
||||
if (stateList == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
if (stateList.ContainsKey(branchHash))
|
||||
{
|
||||
if (stateHasDuplicate(kvp.Key, branchHash) == -2)
|
||||
{
|
||||
if (!stateList[branchHash].IsOnDisk)
|
||||
Used -= (ulong)stateList[branchHash].Length;
|
||||
}
|
||||
}
|
||||
*/
|
||||
stateList.Remove(branchHash);
|
||||
if (stateList.Count == 0)
|
||||
{
|
||||
_branchStates.Remove(kvp.Key);
|
||||
}
|
||||
}
|
||||
|
||||
// AddBranch
|
||||
foreach (KeyValuePair<int, StateManagerState> kvp in _states)
|
||||
{
|
||||
if (!_branchStates.ContainsKey(kvp.Key))
|
||||
{
|
||||
_branchStates.Add(kvp.Key, new SortedList<int, StateManagerState>());
|
||||
}
|
||||
|
||||
SortedList<int, StateManagerState> stateList = _branchStates[kvp.Key];
|
||||
|
||||
if (stateList == null)
|
||||
{
|
||||
stateList = new SortedList<int, StateManagerState>();
|
||||
_branchStates[kvp.Key] = stateList;
|
||||
}
|
||||
|
||||
stateList.Add(branchHash, kvp.Value);
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadBranch(int index)
|
||||
{
|
||||
if (index == -1) // backup branch is outsider
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int branchHash = _movie.BranchHashByIndex(index);
|
||||
|
||||
////Invalidate(0); // Not a good way of doing it?
|
||||
|
||||
foreach (KeyValuePair<int, SortedList<int, StateManagerState>> kvp in _branchStates)
|
||||
{
|
||||
if (kvp.Key == 0 && _states.ContainsKey(0))
|
||||
{
|
||||
continue; // TODO: It might be a better idea to just not put state 0 in BranchStates.
|
||||
}
|
||||
|
||||
if (kvp.Value.ContainsKey(branchHash))
|
||||
{
|
||||
SetState(kvp.Key, kvp.Value[branchHash].State);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,10 +11,9 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
DiskSaveCapacitymb = 512;
|
||||
Capacitymb = 512;
|
||||
DiskCapacitymb = 512;
|
||||
StateGap = 4;
|
||||
BranchStatesInTasproj = false;
|
||||
EraseBranchStatesFirst = true;
|
||||
DiskCapacitymb = 1; // not working yet
|
||||
MemStateGapDivider = 64;
|
||||
FileStateGap = 4;
|
||||
}
|
||||
|
||||
public TasStateManagerSettings(TasStateManagerSettings settings)
|
||||
|
@ -22,9 +21,8 @@ namespace BizHawk.Client.Common
|
|||
DiskSaveCapacitymb = settings.DiskSaveCapacitymb;
|
||||
Capacitymb = settings.Capacitymb;
|
||||
DiskCapacitymb = settings.DiskCapacitymb;
|
||||
StateGap = settings.StateGap;
|
||||
BranchStatesInTasproj = settings.BranchStatesInTasproj;
|
||||
EraseBranchStatesFirst = settings.EraseBranchStatesFirst;
|
||||
MemStateGapDivider = settings.MemStateGapDivider;
|
||||
FileStateGap = settings.FileStateGap;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -55,26 +53,19 @@ namespace BizHawk.Client.Common
|
|||
[Description("The size limit of the state history buffer on the disk. When this limit is reached it will start removing previous savestates")]
|
||||
public int DiskCapacitymb { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the divider that determines memory state gap
|
||||
/// </summary>
|
||||
[DisplayName("Divider for memory state interval")]
|
||||
[Description("The actual state gap in frames is calculated as ExpectedStateSize / div / 1024")]
|
||||
public int MemStateGapDivider { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the amount of states to skip during project saving
|
||||
/// </summary>
|
||||
[DisplayName("State interval for .tasproj")]
|
||||
[Description("The actual state gap in frames is calculated as Nth power on 2")]
|
||||
public int StateGap { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether or not to save branch states into the movie file
|
||||
/// </summary>
|
||||
[DisplayName("Put branch states to .tasproj")]
|
||||
[Description("Put branch states to .tasproj")]
|
||||
public bool BranchStatesInTasproj { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether or not to erase branch states before greenzone states when capacity is met
|
||||
/// </summary>
|
||||
[DisplayName("Erase branch states first")]
|
||||
[Description("Erase branch states before greenzone states when capacity is met")]
|
||||
public bool EraseBranchStatesFirst { get; set; }
|
||||
public int FileStateGap { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The total state capacity in bytes.
|
||||
|
@ -97,9 +88,8 @@ namespace BizHawk.Client.Common
|
|||
sb.AppendLine(DiskSaveCapacitymb.ToString());
|
||||
sb.AppendLine(Capacitymb.ToString());
|
||||
sb.AppendLine(DiskCapacitymb.ToString());
|
||||
sb.AppendLine(BranchStatesInTasproj.ToString());
|
||||
sb.AppendLine(EraseBranchStatesFirst.ToString());
|
||||
sb.AppendLine(StateGap.ToString());
|
||||
sb.AppendLine(FileStateGap.ToString());
|
||||
sb.AppendLine(MemStateGapDivider.ToString());
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
@ -123,13 +113,11 @@ namespace BizHawk.Client.Common
|
|||
DiskSaveCapacitymb = refCapacity;
|
||||
}
|
||||
|
||||
DiskCapacitymb = lines.Length > 2 ? int.Parse(lines[2]) : 512;
|
||||
int i = 2;
|
||||
|
||||
BranchStatesInTasproj = lines.Length > 3 && bool.Parse(lines[3]);
|
||||
|
||||
EraseBranchStatesFirst = lines.Length <= 4 || bool.Parse(lines[4]);
|
||||
|
||||
StateGap = lines.Length > 5 ? int.Parse(lines[5]) : 4;
|
||||
DiskCapacitymb = lines.Length > i ? int.Parse(lines[i++]) : 1;
|
||||
FileStateGap = lines.Length > i ? int.Parse(lines[i++]) : 4;
|
||||
MemStateGapDivider = lines.Length > i ? int.Parse(lines[i++]) : 64;
|
||||
}
|
||||
catch (Exception) // TODO: this is bad
|
||||
{
|
||||
|
|
|
@ -288,17 +288,17 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
if (addr == _watch.Address)
|
||||
{
|
||||
return (byte)(_val & 0xFF);
|
||||
return (byte)(_val >> 8);
|
||||
}
|
||||
return (byte)(_val >> 8);
|
||||
return (byte)(_val & 0xFF);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (addr == _watch.Address)
|
||||
{
|
||||
return (byte)(_val >> 8);
|
||||
return (byte)(_val & 0xFF);
|
||||
}
|
||||
return (byte)(_val & 0xFF);
|
||||
return (byte)(_val >> 8);
|
||||
}
|
||||
case WatchSize.DWord:
|
||||
if (_watch.BigEndian)
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// This class hold a collection <see cref="Watch"/>
|
||||
/// </summary>
|
||||
public sealed partial class WatchList
|
||||
{
|
||||
/// <summary>
|
||||
/// Nested private class that defines how to compare two <see cref="Watch"/>es based on their full display type
|
||||
/// </summary>
|
||||
private sealed class WatchFullDisplayTypeComparer
|
||||
: WatchEqualityComparer, IComparer<Watch>
|
||||
{
|
||||
/// <summary>
|
||||
/// Compares two <see cref="Watch"/>es and determines which has greater size.
|
||||
/// If they are equal, comparison will done on the display type and then on endianness
|
||||
/// </summary>
|
||||
/// <param name="x">First <see cref="Watch"/></param>
|
||||
/// <param name="y">Second <see cref="Watch"/></param>
|
||||
/// <returns>0 for equality, 1 if x comes first; -1 if y comes first</returns>
|
||||
public int Compare(Watch x, Watch y)
|
||||
{
|
||||
if (Equals(x, y))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (x.Size.Equals(y.Size))
|
||||
{
|
||||
if (x.Type.Equals(y.Type))
|
||||
{
|
||||
return x.BigEndian.CompareTo(y.BigEndian);
|
||||
}
|
||||
|
||||
return x.Type.CompareTo(y.Type);
|
||||
}
|
||||
|
||||
return x.Size.CompareTo(y.Size);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -26,11 +26,13 @@ namespace BizHawk.Client.Common
|
|||
public const string PREV = "PrevColumn";
|
||||
public const string CHANGES = "ChangesColumn";
|
||||
public const string DIFF = "DiffColumn";
|
||||
public const string TYPE = "TypeColumn";
|
||||
public const string DOMAIN = "DomainColumn";
|
||||
public const string NOTES = "NotesColumn";
|
||||
|
||||
private static readonly WatchDomainComparer DomainComparer = new WatchDomainComparer();
|
||||
private static readonly WatchAddressComparer AddressComparer = new WatchAddressComparer();
|
||||
private static readonly WatchFullDisplayTypeComparer DisplayTypeComparer = new WatchFullDisplayTypeComparer();
|
||||
private static readonly WatchValueComparer ValueComparer = new WatchValueComparer();
|
||||
private static readonly WatchPreviousValueComparer PreviousValueComparer = new WatchPreviousValueComparer();
|
||||
private static readonly WatchValueDifferenceComparer ValueDifferenceComparer = new WatchValueDifferenceComparer();
|
||||
|
@ -297,6 +299,19 @@ namespace BizHawk.Client.Common
|
|||
|
||||
break;
|
||||
|
||||
case TYPE:
|
||||
if (reverse)
|
||||
{
|
||||
_watchList.Sort(DisplayTypeComparer);
|
||||
_watchList.Reverse();
|
||||
}
|
||||
else
|
||||
{
|
||||
_watchList.Sort(DisplayTypeComparer);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case NOTES:
|
||||
if (reverse)
|
||||
{
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<!--<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>-->
|
||||
<CodeAnalysisRuleSet Condition=" '$(OS)' == 'Windows_NT' ">MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
|
||||
<OutputPath>..\output\</OutputPath>
|
||||
|
@ -22,7 +23,8 @@
|
|||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<!--<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>-->
|
||||
<CodeAnalysisRuleSet Condition=" '$(OS)' == 'Windows_NT' ">MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
|
@ -36,6 +38,7 @@
|
|||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="CSharp-SQLite">
|
||||
|
@ -47,7 +50,7 @@
|
|||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.XML" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -114,4 +117,4 @@
|
|||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
@ -51,7 +51,8 @@
|
|||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<!--<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>-->
|
||||
<CodeAnalysisRuleSet Condition=" '$(OS)' == 'Windows_NT' ">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
|
||||
<OutputPath>..\output\</OutputPath>
|
||||
|
@ -61,7 +62,8 @@
|
|||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<!--<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>-->
|
||||
<CodeAnalysisRuleSet Condition=" '$(OS)' == 'Windows_NT' ">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
|
||||
</PropertyGroup>
|
||||
|
@ -165,4 +167,4 @@
|
|||
<PropertyGroup>
|
||||
<PreBuildEvent />
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
@ -48,17 +48,30 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
return new[]
|
||||
{
|
||||
new FormatPreset("Uncompressed AVI", "AVI file with uncompressed audio and video. Very large.", "-c:a pcm_s16le -c:v rawvideo -f avi", false, "avi"),
|
||||
new FormatPreset("Xvid", "AVI file with xvid video and mp3 audio.", "-c:a libmp3lame -c:v libxvid -f avi", false, "avi"),
|
||||
//new FormatPreset("Lossless Compressed AVI", "AVI file with zlib video and uncompressed audio.", "-c:a pcm_s16le -c:v zlib -f avi", false, "avi"),
|
||||
new FormatPreset("FLV", "avc+aac in flash container.", "-c:a libvo_aacenc -c:v libx264 -f flv", false, "flv"),
|
||||
new FormatPreset("Matroska Lossless", "MKV file with lossless video and audio", "-c:a pcm_s16le -c:v libx264rgb -crf 0 -f matroska", false, "mkv"),
|
||||
new FormatPreset("Matroska", "MKV file with h264 + vorbis", "-c:a libvorbis -c:v libx264 -f matroska", false, "mkv"),
|
||||
new FormatPreset("QuickTime", "MOV file with avc+aac", "-c:a libvo_aacenc -c:v libx264 -f mov", false, "mov"),
|
||||
new FormatPreset("Ogg", "Theora + Vorbis in OGG", "-c:a libvorbis -c:v libtheora -f ogg", false, "ogg"),
|
||||
new FormatPreset("WebM", "Vp8 + Vorbis in WebM", "-c:a libvorbis -c:v libvpx -f webm", false, "webm"),
|
||||
new FormatPreset("mp4", "ISO mp4 with AVC+AAC", "-c:a libvo_aacenc -c:v libx264 -f mp4", false, "mp4"),
|
||||
new FormatPreset("[Custom]", "Write your own ffmpeg command. For advanced users only", "-c:a foo -c:v bar -f baz", true, "foobar"),
|
||||
new FormatPreset("AVI Uncompressed", "Uncompressed video and audio in an AVI container. Very large.",
|
||||
"-c:a pcm_s16le -c:v rawvideo -f avi", false, "avi"),
|
||||
new FormatPreset("AVI Lossless", "Lossless FFV1 video and uncompressed audio in an AVI container. Compatible with AVISource, if ffmpeg based decoder is installed.",
|
||||
"-c:a pcm_s16le -c:v ffv1 -pix_fmt bgr0 -level 1 -g 1 -coder 1 -context 1 -f avi", false, "avi"),
|
||||
//new FormatPreset("AVI Lossless", "Lossless zlib video and uncompressed audio in an AVI container.",
|
||||
// "-c:a pcm_s16le -c:v zlib -f avi", false, "avi"),
|
||||
new FormatPreset("Matroska Lossless", "Lossless AVC video and uncompressed audio in a Matroska container.",
|
||||
"-c:a pcm_s16le -c:v libx264rgb -crf 0 -f matroska", false, "mkv"),
|
||||
new FormatPreset("Matroska", "AVC video and Vorbis audio in a Matroska container.",
|
||||
"-c:a libvorbis -c:v libx264 -f matroska", false, "mkv"),
|
||||
new FormatPreset("MP4", "AVC video and AAC audio in an MP4 container.",
|
||||
"-c:a libvo_aacenc -c:v libx264 -f mp4", false, "mp4"),
|
||||
new FormatPreset("WebM", "VP8 video and Vorbis audio in a WebM container.",
|
||||
"-c:a libvorbis -c:v libvpx -f webm", false, "webm"),
|
||||
new FormatPreset("Ogg", "Theora video and Vorbis audio in an Ogg contrainer.",
|
||||
"-c:a libvorbis -c:v libtheora -f ogg", false, "ogg"),
|
||||
new FormatPreset("Xvid", "Xvid video and MP3 audio in an AVI container.",
|
||||
"-c:a libmp3lame -c:v libxvid -f avi", false, "avi"),
|
||||
new FormatPreset("QuickTime", "AVC video and AAC audio in a QuickTime container.",
|
||||
"-c:a libvo_aacenc -c:v libx264 -f mov", false, "mov"),
|
||||
new FormatPreset("FLV", "AVC video and AAC audio in a Flash Video container.",
|
||||
"-c:a libvo_aacenc -c:v libx264 -f flv", false, "flv"),
|
||||
new FormatPreset("[Custom]", "Write your own ffmpeg command. For advanced users only.",
|
||||
"-c:a foo -c:v bar -f baz", true, "foobar"),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -27,11 +27,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
public bool luaConsole = false;
|
||||
public int socket_port = 9999;
|
||||
public string socket_ip = null;
|
||||
public string mmf_filename = null;
|
||||
public string URL_get = null;
|
||||
public string URL_post = null;
|
||||
|
||||
public void ParseArguments(string[] args)
|
||||
|
||||
public void parseArguments(string[] args)
|
||||
|
||||
{
|
||||
for (int i = 0; i<args.Length; i++)
|
||||
for (int i = 0; i < args.Length; i++)
|
||||
{
|
||||
// For some reason sometimes visual studio will pass this to us on the commandline. it makes no sense.
|
||||
if (args[i] == ">")
|
||||
|
@ -50,11 +53,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
if (arg.StartsWith("--load-state="))
|
||||
{
|
||||
cmdLoadState = arg.Substring(arg.IndexOf('=') + 1);
|
||||
cmdLoadState = args[i].Substring(args[i].IndexOf('=') + 1);
|
||||
}
|
||||
else if (arg.StartsWith("--movie="))
|
||||
{
|
||||
cmdMovie = arg.Substring(arg.IndexOf('=') + 1);
|
||||
cmdMovie = args[i].Substring(args[i].IndexOf('=') + 1);
|
||||
}
|
||||
else if (arg.StartsWith("--dump-type="))
|
||||
{
|
||||
|
@ -62,8 +65,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
else if (arg.StartsWith("--dump-frames="))
|
||||
{
|
||||
var list = arg.Substring(arg.IndexOf('=') + 1);
|
||||
var items = list.Split(',');
|
||||
string list = arg.Substring(arg.IndexOf('=') + 1);
|
||||
string[] items = list.Split(',');
|
||||
_currAviWriterFrameList = new HashSet<int>();
|
||||
foreach (string item in items)
|
||||
{
|
||||
|
@ -75,7 +78,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
else if (arg.StartsWith("--dump-name="))
|
||||
{
|
||||
cmdDumpName = arg.Substring(arg.IndexOf('=') + 1);
|
||||
cmdDumpName = args[i].Substring(args[i].IndexOf('=') + 1);
|
||||
}
|
||||
else if (arg.StartsWith("--dump-length="))
|
||||
{
|
||||
|
@ -95,7 +98,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
else if (arg.StartsWith("--lua="))
|
||||
{
|
||||
luaScript = arg.Substring(arg.IndexOf('=') + 1);
|
||||
luaScript = args[i].Substring(args[i].IndexOf('=') + 1);
|
||||
luaConsole = true;
|
||||
}
|
||||
else if (arg.StartsWith("--luaconsole"))
|
||||
|
@ -110,11 +113,55 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
socket_ip = arg.Substring(arg.IndexOf('=') + 1);
|
||||
}
|
||||
else if (arg.StartsWith("--mmf="))
|
||||
{
|
||||
mmf_filename = args[i].Substring(args[i].IndexOf('=') + 1);
|
||||
}
|
||||
else if (arg.StartsWith("--url_get="))
|
||||
{
|
||||
URL_get = args[i].Substring(args[i].IndexOf('=') + 1);
|
||||
}
|
||||
else if (arg.StartsWith("--url_post="))
|
||||
{
|
||||
URL_post = args[i].Substring(args[i].IndexOf('=') + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
cmdRom = args[i];
|
||||
}
|
||||
}
|
||||
////initialize HTTP communication
|
||||
if (URL_get != null || URL_post != null)
|
||||
{
|
||||
if (URL_get != null)
|
||||
{
|
||||
GlobalWin.httpCommunication.initialized = true;
|
||||
GlobalWin.httpCommunication.SetGetUrl(URL_get);
|
||||
}
|
||||
if (URL_post != null)
|
||||
{
|
||||
GlobalWin.httpCommunication.initialized = true;
|
||||
GlobalWin.httpCommunication.SetPostUrl(URL_post);
|
||||
}
|
||||
}
|
||||
//inititalize socket server
|
||||
if (socket_ip != null && socket_port > -1)
|
||||
{
|
||||
GlobalWin.socketServer.initialized = true;
|
||||
GlobalWin.socketServer.SetIp(socket_ip, socket_port);
|
||||
}
|
||||
else if (socket_ip != null)
|
||||
{
|
||||
GlobalWin.socketServer.initialized = true;
|
||||
GlobalWin.socketServer.SetIp(socket_ip);
|
||||
}
|
||||
|
||||
//initialize mapped memory files
|
||||
if (mmf_filename != null)
|
||||
{
|
||||
GlobalWin.memoryMappedFiles.initialized = true;
|
||||
GlobalWin.memoryMappedFiles.SetFilename(mmf_filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.CoreInfoPanel = new System.Windows.Forms.Panel();
|
||||
//this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.VersionLabel = new System.Windows.Forms.Label();
|
||||
this.btnCopyHash = new System.Windows.Forms.Button();
|
||||
this.linkLabel2 = new System.Windows.Forms.LinkLabel();
|
||||
|
@ -146,7 +145,6 @@
|
|||
//
|
||||
// linkLabel3
|
||||
//
|
||||
this.linkLabel3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.linkLabel3.AutoSize = true;
|
||||
this.linkLabel3.Location = new System.Drawing.Point(198, 112);
|
||||
this.linkLabel3.Name = "linkLabel3";
|
||||
|
@ -176,7 +174,6 @@
|
|||
this.Controls.Add(this.linkLabel3);
|
||||
this.Controls.Add(this.linkLabel2);
|
||||
this.Controls.Add(this.btnCopyHash);
|
||||
//this.Controls.Add(this.textBox1);
|
||||
this.Controls.Add(this.CoreInfoPanel);
|
||||
this.Controls.Add(this.VersionLabel);
|
||||
this.Controls.Add(this.label4);
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<NoWin32Manifest>true</NoWin32Manifest>
|
||||
|
@ -50,7 +51,8 @@
|
|||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<!--<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>-->
|
||||
<CodeAnalysisRuleSet Condition=" '$(OS)' == 'Windows_NT' ">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
|
||||
<OutputPath>..\output\</OutputPath>
|
||||
|
@ -61,7 +63,8 @@
|
|||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<!--<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>-->
|
||||
<CodeAnalysisRuleSet Condition=" '$(OS)' == 'Windows_NT' ">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="GongShell">
|
||||
|
@ -71,7 +74,8 @@
|
|||
<HintPath>..\References\ICSharpCode.SharpZipLib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="Microsoft.VisualBasic" Condition=" '$(OS)' == 'Windows_NT' " />
|
||||
<!--<Reference Include="Microsoft.VisualBasic" Condition=" '$(OS)' == 'Windows_NT' " />-->
|
||||
<Reference Include="Microsoft.VisualBasic" />
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>..\References\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -92,6 +96,7 @@
|
|||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.DirectoryServices" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Xaml" />
|
||||
<Reference Include="System.Xml.Linq">
|
||||
|
@ -193,6 +198,7 @@
|
|||
<Compile Include="BizBoxInfoControl.Designer.cs">
|
||||
<DependentUpon>BizBoxInfoControl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Communication.cs" />
|
||||
<Compile Include="config\AnalogRangeConfig.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
|
@ -598,7 +604,8 @@
|
|||
</Compile>
|
||||
<Compile Include="GLManager.cs" />
|
||||
<Compile Include="GlobalWin.cs" />
|
||||
<Compile Include="Input\GamePad.cs" Condition=" '$(OS)' == 'Windows_NT' " />
|
||||
<!--<Compile Include="Input\GamePad.cs" Condition=" '$(OS)' == 'Windows_NT' " />-->
|
||||
<Compile Include="Input\GamePad.cs" />
|
||||
<Compile Include="Input\GamePad360.cs" />
|
||||
<Compile Include="Input\Input.cs" />
|
||||
<Compile Include="IControlMainform.cs" />
|
||||
|
@ -625,7 +632,8 @@
|
|||
<Compile Include="movie\EditCommentsForm.Designer.cs">
|
||||
<DependentUpon>EditCommentsForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Input\Keyboard.cs" Condition=" '$(OS)' == 'Windows_NT' " />
|
||||
<!--<Compile Include="Input\Keyboard.cs" Condition=" '$(OS)' == 'Windows_NT' " />-->
|
||||
<Compile Include="Input\Keyboard.cs" />
|
||||
<Compile Include="MainForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
@ -871,6 +879,7 @@
|
|||
<DependentUpon>NewHexEditor.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="tools\Lua\Libraries\EmuLuaLibrary.Client.cs" />
|
||||
<Compile Include="tools\Lua\Libraries\EmuLuaLibrary.Communication.cs" />
|
||||
<Compile Include="tools\Lua\Libraries\EmuLuaLibrary.Console.cs" />
|
||||
<Compile Include="tools\Lua\Libraries\EmuLuaLibrary.cs" />
|
||||
<Compile Include="tools\Lua\Libraries\EmuLuaLibrary.Forms.cs" />
|
||||
|
@ -2173,4 +2182,4 @@
|
|||
<PreBuildEvent />
|
||||
</PropertyGroup>
|
||||
<Import Project="$(SolutionDir)Build\Common.targets" />
|
||||
</Project>
|
||||
</Project>
|
|
@ -0,0 +1,445 @@
|
|||
using System;
|
||||
using System.Text;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using System.Net.Http;
|
||||
using System.IO.MemoryMappedFiles;
|
||||
using BizHawk.Bizware.BizwareGL;
|
||||
using System.Drawing;
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Emulation.Common.IEmulatorExtensions;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
|
||||
public class Communication
|
||||
{
|
||||
|
||||
public class HttpCommunication
|
||||
{
|
||||
private static HttpClient client = new HttpClient();
|
||||
private string PostUrl = "http://localhost:9876/post/";
|
||||
private string GetUrl = "http://localhost:9876/index";
|
||||
public bool initialized = false;
|
||||
private ScreenShot screenShot = new ScreenShot();
|
||||
public int timeout = 0;
|
||||
public int default_timeout = 500;
|
||||
|
||||
public void SetTimeout(int _timeout)
|
||||
{
|
||||
//timeout = _timeout.TotalMilliseconds;
|
||||
if (timeout == 0 && _timeout == 0)
|
||||
{
|
||||
timeout = default_timeout;
|
||||
}
|
||||
if (_timeout != 0)
|
||||
{
|
||||
client.Timeout = new TimeSpan(0, 0, 0, _timeout / 1000, _timeout % 1000);
|
||||
timeout = _timeout;
|
||||
}
|
||||
|
||||
}
|
||||
public void SetPostUrl(string url)
|
||||
{
|
||||
PostUrl = url;
|
||||
}
|
||||
public void SetGetUrl(string url)
|
||||
{
|
||||
GetUrl = url;
|
||||
}
|
||||
|
||||
public string GetGetUrl()
|
||||
{
|
||||
return GetUrl;
|
||||
}
|
||||
public string GetPostUrl()
|
||||
{
|
||||
return PostUrl;
|
||||
}
|
||||
|
||||
public async Task<string> Get(string url)
|
||||
{
|
||||
client.DefaultRequestHeaders.ConnectionClose = false;
|
||||
HttpResponseMessage response = await client.GetAsync(url).ConfigureAwait(false);
|
||||
if (response.IsSuccessStatusCode) {
|
||||
return await response.Content.ReadAsStringAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<string> Post(string url, FormUrlEncodedContent content)
|
||||
{
|
||||
client.DefaultRequestHeaders.ConnectionClose = true;
|
||||
HttpResponseMessage response = null;
|
||||
try
|
||||
{
|
||||
response = await client.PostAsync(url, content).ConfigureAwait(false);
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show(e.ToString());
|
||||
return e.ToString();
|
||||
|
||||
}
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return await response.Content.ReadAsStringAsync();
|
||||
}
|
||||
|
||||
public string TestGet()
|
||||
{
|
||||
Task<String> getResponse = Get(GetUrl);
|
||||
return getResponse.Result;
|
||||
}
|
||||
|
||||
public string SendScreenshot(string url, string parameter)
|
||||
{
|
||||
int trials = 5;
|
||||
var values = new Dictionary<string, string>
|
||||
{
|
||||
{parameter, screenShot.GetScreenShotAsString()},
|
||||
};
|
||||
FormUrlEncodedContent content = new FormUrlEncodedContent(values);
|
||||
|
||||
Task<string> postResponse = null;
|
||||
while (postResponse == null && trials > 0)
|
||||
{
|
||||
postResponse = Post(PostUrl, content);
|
||||
trials -= 1;
|
||||
}
|
||||
return postResponse.Result;
|
||||
}
|
||||
|
||||
public string SendScreenshot()
|
||||
{
|
||||
return SendScreenshot(PostUrl, "screenshot");
|
||||
}
|
||||
|
||||
public string SendScreenshot(string url)
|
||||
{
|
||||
return SendScreenshot(url, "screenshot");
|
||||
}
|
||||
|
||||
public string ExecGet(string url)
|
||||
{
|
||||
return Get(url).Result;
|
||||
}
|
||||
|
||||
public string ExecGet()
|
||||
{
|
||||
return Get(GetUrl).Result;
|
||||
}
|
||||
|
||||
public string ExecPost(string url, string payload)
|
||||
{
|
||||
var values = new Dictionary<string, string>
|
||||
{
|
||||
{"payload", payload},
|
||||
};
|
||||
FormUrlEncodedContent content = new FormUrlEncodedContent(values);
|
||||
return Post(url, content).Result;
|
||||
}
|
||||
|
||||
public string ExecPost(string payload)
|
||||
{
|
||||
var values = new Dictionary<string, string>
|
||||
{
|
||||
{"payload", payload},
|
||||
};
|
||||
FormUrlEncodedContent content = new FormUrlEncodedContent(values);
|
||||
return Post(PostUrl, content).Result;
|
||||
}
|
||||
}
|
||||
public class SocketServer
|
||||
{
|
||||
|
||||
public string ip = "192.168.178.21";
|
||||
public int port = 9999;
|
||||
public Decoder decoder = Encoding.UTF8.GetDecoder();
|
||||
public Socket soc = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||
public IPAddress ipAdd;
|
||||
public IPEndPoint remoteEP;
|
||||
public IVideoProvider currentVideoProvider = null;
|
||||
public bool connected = false;
|
||||
public bool initialized = false;
|
||||
public int retries = 10;
|
||||
public bool success = false; //indicates whether the last command was executed succesfully
|
||||
|
||||
public void Initialize(IVideoProvider _currentVideoProvider)
|
||||
{
|
||||
currentVideoProvider = _currentVideoProvider;
|
||||
SetIp(ip, port);
|
||||
initialized = true;
|
||||
|
||||
}
|
||||
public void Connect()
|
||||
{
|
||||
if (!initialized)
|
||||
{
|
||||
Initialize(currentVideoProvider);
|
||||
}
|
||||
remoteEP = new IPEndPoint(ipAdd, port);
|
||||
soc = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||
soc.Connect(remoteEP);
|
||||
connected = true;
|
||||
soc.ReceiveTimeout = 5;
|
||||
|
||||
}
|
||||
public void SetIp(string ip_)
|
||||
{
|
||||
ip = ip_;
|
||||
ipAdd = System.Net.IPAddress.Parse(ip);
|
||||
remoteEP = new IPEndPoint(ipAdd, port);
|
||||
}
|
||||
public void SetIp(string ip_, int port_)
|
||||
{
|
||||
ip = ip_;
|
||||
port = port_;
|
||||
ipAdd = System.Net.IPAddress.Parse(ip);
|
||||
remoteEP = new IPEndPoint(ipAdd, port);
|
||||
|
||||
}
|
||||
public void SetTimeout(int timeout)
|
||||
{
|
||||
soc.ReceiveTimeout = timeout;
|
||||
}
|
||||
public void SocketConnected()
|
||||
{
|
||||
bool part1 = soc.Poll(1000, SelectMode.SelectRead);
|
||||
bool part2 = (soc.Available == 0);
|
||||
if (part1 && part2)
|
||||
connected = false;
|
||||
else
|
||||
connected = true;
|
||||
}
|
||||
public int SendString(string SendString)
|
||||
{
|
||||
|
||||
int sentBytes = SendBytes(Encoding.ASCII.GetBytes(SendString));
|
||||
success = sentBytes > 0;
|
||||
return sentBytes;
|
||||
}
|
||||
public int SendBytes(byte[] SendBytes)
|
||||
{
|
||||
int sentBytes = 0;
|
||||
try
|
||||
{
|
||||
sentBytes = soc.Send(SendBytes);
|
||||
}
|
||||
catch
|
||||
{
|
||||
sentBytes = -1;
|
||||
}
|
||||
return sentBytes;
|
||||
}
|
||||
|
||||
public string SendScreenshot()
|
||||
{
|
||||
return SendScreenshot(0);
|
||||
}
|
||||
public string SendScreenshot(int waitingTime)
|
||||
{
|
||||
if (!connected)
|
||||
{
|
||||
Connect();
|
||||
}
|
||||
ScreenShot screenShot = new ScreenShot();
|
||||
using (BitmapBuffer bb = screenShot.MakeScreenShotImage())
|
||||
{
|
||||
using (var img = bb.ToSysdrawingBitmap())
|
||||
{
|
||||
byte[] bmpBytes = screenShot.ImageToByte(img);
|
||||
int sentBytes = 0;
|
||||
int tries = 0;
|
||||
while (sentBytes <= 0 && tries < retries)
|
||||
{
|
||||
try
|
||||
{
|
||||
tries++;
|
||||
sentBytes = SendBytes(bmpBytes);
|
||||
}
|
||||
catch (SocketException)
|
||||
{
|
||||
Connect();
|
||||
sentBytes = 0;
|
||||
}
|
||||
if (sentBytes == -1)
|
||||
{
|
||||
Connect();
|
||||
}
|
||||
}
|
||||
success = (tries < retries);
|
||||
}
|
||||
}
|
||||
String resp = "";
|
||||
if (!success)
|
||||
{
|
||||
resp = "Screenshot could not be sent";
|
||||
} else
|
||||
{
|
||||
resp = "Screenshot was sent";
|
||||
}
|
||||
if (waitingTime == 0)
|
||||
{
|
||||
return resp;
|
||||
}
|
||||
resp = "";
|
||||
resp = ReceiveMessage();
|
||||
if (resp == "")
|
||||
{
|
||||
resp = "Failed to get a response";
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
public string ReceiveMessage()
|
||||
{
|
||||
if (!connected)
|
||||
{
|
||||
Connect();
|
||||
}
|
||||
string resp = "";
|
||||
byte[] receivedBytes = new byte[256];
|
||||
int receivedLength = 1;
|
||||
|
||||
while (receivedLength > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
receivedLength = soc.Receive(receivedBytes, receivedBytes.Length, 0);
|
||||
resp += Encoding.ASCII.GetString(receivedBytes);
|
||||
} catch
|
||||
{
|
||||
receivedLength = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return resp;
|
||||
}
|
||||
public bool Successful()
|
||||
{
|
||||
return success;
|
||||
}
|
||||
}
|
||||
|
||||
public class MemoryMappedFiles
|
||||
{
|
||||
public string filename_main = "BizhawkTemp_main";
|
||||
public Dictionary<string, MemoryMappedFile> mmf_files = new Dictionary<string, MemoryMappedFile>();
|
||||
public int index = 0;
|
||||
public bool initialized = false;
|
||||
public int main_size = 10 ^ 5;
|
||||
ScreenShot screenShot = new ScreenShot();
|
||||
|
||||
public void SetFilename(string filename)
|
||||
{
|
||||
filename_main = filename;
|
||||
}
|
||||
public string GetFilename()
|
||||
{
|
||||
return filename_main;
|
||||
}
|
||||
|
||||
public int ScreenShotToFile()
|
||||
{
|
||||
ScreenShot screenShot = new ScreenShot();
|
||||
var bb = screenShot.MakeScreenShotImage();
|
||||
var img = bb.ToSysdrawingBitmap();
|
||||
byte[] bmpBytes = screenShot.ImageToByte(img);
|
||||
return WriteToFile(@filename_main, bmpBytes);
|
||||
}
|
||||
|
||||
public int WriteToFile(string filename, byte[] outputBytes)
|
||||
{
|
||||
MemoryMappedFile mmf_file;
|
||||
int bytesWritten = -1;
|
||||
if (mmf_files.TryGetValue(filename, out mmf_file) == false)
|
||||
{
|
||||
mmf_file = MemoryMappedFile.CreateOrOpen(filename, outputBytes.Length);
|
||||
mmf_files[filename] = mmf_file;
|
||||
}
|
||||
try
|
||||
{
|
||||
using (MemoryMappedViewAccessor accessor = mmf_file.CreateViewAccessor(0, outputBytes.Length, MemoryMappedFileAccess.Write))
|
||||
{
|
||||
accessor.WriteArray<byte>(0, outputBytes, 0, outputBytes.Length);
|
||||
bytesWritten = outputBytes.Length;
|
||||
}
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
try
|
||||
{
|
||||
mmf_file.Dispose();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
mmf_file = MemoryMappedFile.CreateOrOpen(filename, outputBytes.Length);
|
||||
mmf_files[filename] = mmf_file;
|
||||
using (MemoryMappedViewAccessor accessor = mmf_file.CreateViewAccessor(0, outputBytes.Length, MemoryMappedFileAccess.Write))
|
||||
{
|
||||
accessor.WriteArray<byte>(0, outputBytes, 0, outputBytes.Length);
|
||||
bytesWritten = outputBytes.Length;
|
||||
}
|
||||
}
|
||||
return bytesWritten;
|
||||
}
|
||||
|
||||
public string ReadFromFile(string filename, int expectedSize)
|
||||
{
|
||||
MemoryMappedFile mmf_file = mmf_file = MemoryMappedFile.OpenExisting(@filename);
|
||||
using (MemoryMappedViewAccessor viewAccessor = mmf_file.CreateViewAccessor())
|
||||
{
|
||||
byte[] bytes = new byte[expectedSize];
|
||||
viewAccessor.ReadArray(0, bytes, 0, bytes.Length);
|
||||
string text = Encoding.UTF8.GetString(bytes);
|
||||
return text;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class ScreenShot
|
||||
//makes all functionalities for providing screenshots available
|
||||
{
|
||||
private IVideoProvider currentVideoProvider = null;
|
||||
private ImageConverter converter = new ImageConverter();
|
||||
public BitmapBuffer MakeScreenShotImage()
|
||||
{
|
||||
if (currentVideoProvider == null)
|
||||
{
|
||||
currentVideoProvider = Global.Emulator.AsVideoProviderOrDefault();
|
||||
}
|
||||
return GlobalWin.DisplayManager.RenderVideoProvider(currentVideoProvider);
|
||||
}
|
||||
public byte[] ImageToByte(Image img)
|
||||
{
|
||||
return (byte[])converter.ConvertTo(img, typeof(byte[]));
|
||||
}
|
||||
public string ImageToString(Image img)
|
||||
{
|
||||
return Convert.ToBase64String(ImageToByte(img));
|
||||
}
|
||||
public string GetScreenShotAsString()
|
||||
{
|
||||
BitmapBuffer bb = MakeScreenShotImage();
|
||||
byte[] imgBytes = ImageToByte(bb.ToSysdrawingBitmap());
|
||||
return Convert.ToBase64String(imgBytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1106,7 +1106,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
// do marker drag here
|
||||
}
|
||||
else if (ModifierKeys == Keys.Shift)
|
||||
else if (ModifierKeys == Keys.Shift && (CurrentCell.Column.Name == "FrameColumn" || CurrentCell.Column.Type == RollColumn.InputType.Text))
|
||||
{
|
||||
if (_selectedItems.Any())
|
||||
{
|
||||
|
@ -1175,11 +1175,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
SelectCell(CurrentCell);
|
||||
}
|
||||
}
|
||||
else if (ModifierKeys == Keys.Control)
|
||||
else if (ModifierKeys == Keys.Control && (CurrentCell.Column.Name == "FrameColumn" || CurrentCell.Column.Type == RollColumn.InputType.Text))
|
||||
{
|
||||
SelectCell(CurrentCell, toggle: true);
|
||||
}
|
||||
else
|
||||
else if (ModifierKeys != Keys.Shift)
|
||||
{
|
||||
var hadIndex = _selectedItems.Any();
|
||||
_selectedItems.Clear();
|
||||
|
@ -1319,6 +1319,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
HorizontalOrientation ^= true;
|
||||
}
|
||||
// Scroll
|
||||
else if (!e.Control && !e.Alt && !e.Shift && e.KeyCode == Keys.PageUp) // Page Up
|
||||
{
|
||||
if (FirstVisibleRow > 0)
|
||||
|
@ -1352,9 +1353,26 @@ namespace BizHawk.Client.EmuHawk
|
|||
LastVisibleRow = RowCount;
|
||||
Refresh();
|
||||
}
|
||||
else if (!e.Control && !e.Shift && !e.Alt && e.KeyCode == Keys.Up) // Up
|
||||
{
|
||||
if (FirstVisibleRow > 0)
|
||||
{
|
||||
FirstVisibleRow--;
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
else if (!e.Control && !e.Shift && !e.Alt && e.KeyCode == Keys.Down) // Down
|
||||
{
|
||||
if (FirstVisibleRow < RowCount - 1)
|
||||
{
|
||||
FirstVisibleRow++;
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
// Selection courser
|
||||
else if (e.Control && !e.Shift && !e.Alt && e.KeyCode == Keys.Up) // Ctrl + Up
|
||||
{
|
||||
if (SelectedRows.Any() && LetKeysModifySelection)
|
||||
if (SelectedRows.Any() && LetKeysModifySelection && SelectedRows.First() > 0)
|
||||
{
|
||||
foreach (var row in SelectedRows.ToList())
|
||||
{
|
||||
|
@ -1374,36 +1392,70 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (!e.Control && e.Shift && !e.Alt && e.KeyCode == Keys.Up) // Shift + Up
|
||||
else if (e.Control && !e.Shift && !e.Alt && e.KeyCode == Keys.Left) // Ctrl + Left
|
||||
{
|
||||
if (SelectedRows.Any() && LetKeysModifySelection)
|
||||
{
|
||||
SelectRow(SelectedRows.First() - 1, true);
|
||||
SelectRow(SelectedRows.Last(), false);
|
||||
}
|
||||
}
|
||||
else if (!e.Control && e.Shift && !e.Alt && e.KeyCode == Keys.Down) // Shift + Down
|
||||
else if (e.Control && !e.Shift && !e.Alt && e.KeyCode == Keys.Right) // Ctrl + Right
|
||||
{
|
||||
if (SelectedRows.Any() && LetKeysModifySelection)
|
||||
if (SelectedRows.Any() && LetKeysModifySelection && SelectedRows.Last() < _rowCount - 1)
|
||||
{
|
||||
SelectRow(SelectedRows.Last() + 1, true);
|
||||
}
|
||||
}
|
||||
else if (!e.Control && !e.Shift && !e.Alt && e.KeyCode == Keys.Up) // Up
|
||||
else if (e.Control && e.Shift && !e.Alt && e.KeyCode == Keys.Left) // Ctrl + Shift + Left
|
||||
{
|
||||
if (FirstVisibleRow > 0)
|
||||
if (SelectedRows.Any() && LetKeysModifySelection && SelectedRows.First() > 0)
|
||||
{
|
||||
FirstVisibleRow--;
|
||||
Refresh();
|
||||
SelectRow(SelectedRows.First() - 1, true);
|
||||
}
|
||||
}
|
||||
else if (!e.Control && !e.Shift && !e.Alt && e.KeyCode == Keys.Down) // Down
|
||||
else if (e.Control && e.Shift && !e.Alt && e.KeyCode == Keys.Right) // Ctrl + Shift + Right
|
||||
{
|
||||
if (FirstVisibleRow < RowCount - 1)
|
||||
if (SelectedRows.Any() && LetKeysModifySelection)
|
||||
{
|
||||
FirstVisibleRow++;
|
||||
Refresh();
|
||||
SelectRow(SelectedRows.First(), false);
|
||||
}
|
||||
}
|
||||
else if (e.Control && !e.Shift && !e.Alt && e.KeyCode == Keys.PageUp) // Ctrl + Page Up
|
||||
{
|
||||
//jump to above marker with selection courser
|
||||
if (LetKeysModifySelection)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
else if (e.Control && !e.Shift && !e.Alt && e.KeyCode == Keys.PageDown) // Ctrl + Page Down
|
||||
{
|
||||
//jump to below marker with selection courser
|
||||
if (LetKeysModifySelection)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else if (e.Control && !e.Shift && !e.Alt && e.KeyCode == Keys.Home) // Ctrl + Home
|
||||
{
|
||||
//move selection courser to frame 0
|
||||
if (LetKeysModifySelection)
|
||||
{
|
||||
DeselectAll();
|
||||
SelectRow(0, true);
|
||||
}
|
||||
}
|
||||
else if (e.Control && !e.Shift && !e.Alt && e.KeyCode == Keys.End) // Ctrl + End
|
||||
{
|
||||
//move selection courser to end of movie
|
||||
if (LetKeysModifySelection)
|
||||
{
|
||||
DeselectAll();
|
||||
SelectRow(RowCount-1, true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
base.OnKeyDown(e);
|
||||
|
|
|
@ -274,9 +274,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
SourceStickyOr = Global.AutofireStickyXORAdapter
|
||||
};
|
||||
|
||||
var lg = Global.MovieSession.LogGeneratorInstance();
|
||||
lg.SetSource(stickyOr);
|
||||
return MakeStringFor(stickyOr);
|
||||
}
|
||||
|
||||
private string MakeStringFor(IController controller)
|
||||
{
|
||||
var lg = Global.MovieSession.LogGeneratorInstance();
|
||||
lg.SetSource(controller);
|
||||
return lg.GenerateInputDisplay();
|
||||
}
|
||||
|
||||
|
@ -345,28 +349,41 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
else // TODO: message config -- allow setting of "previous", "mixed", and "auto"
|
||||
{
|
||||
var previousColor = Color.Orange;
|
||||
Color immediateColor = Color.FromArgb(Global.Config.MessagesColor);
|
||||
var autoColor = Color.Pink;
|
||||
var changedColor = Color.PeachPuff;
|
||||
|
||||
//we need some kind of string for calculating position when right-anchoring, of something like that
|
||||
var bgStr = InputStrOrAll();
|
||||
var x = GetX(g, Global.Config.DispInpx, Global.Config.DispInpanchor, bgStr);
|
||||
var y = GetY(g, Global.Config.DispInpy, Global.Config.DispInpanchor, bgStr);
|
||||
g.DrawString(bgStr, MessageFont, Color.Black, x + 1, y + 1);
|
||||
|
||||
|
||||
//now, we're going to render these repeatedly, with higher-priority things overriding
|
||||
|
||||
//first display previous frame's input.
|
||||
//note: that's only available in case we're working on a movie
|
||||
var previousStr = InputPrevious();
|
||||
var pColor = Color.Orange;
|
||||
g.DrawString(previousStr, MessageFont, pColor, x, y);
|
||||
|
||||
g.DrawString(previousStr, MessageFont, previousColor, x, y);
|
||||
|
||||
//next, draw the immediate input.
|
||||
//that is, whatever's being held down interactively right this moment even if the game is paused
|
||||
//this includes things held down due to autohold or autofire
|
||||
//I know, this is all really confusing
|
||||
var immediate = InputStrImmediate();
|
||||
Color immediateColor = Color.FromArgb(Global.Config.MessagesColor);
|
||||
g.DrawString(immediate, MessageFont, immediateColor, x, y);
|
||||
|
||||
var immediateOverlay = MakeIntersectImmediatePrevious();
|
||||
var oColor = Color.PeachPuff;
|
||||
g.DrawString(immediateOverlay, MessageFont, oColor, x, y);
|
||||
//next draw anything that's pressed because it's sticky.
|
||||
//this applies to autofire and autohold both. somehow. I dont understand it.
|
||||
//basically we're tinting whatever's pressed because it's sticky specially
|
||||
//in order to achieve this we want to avoid drawing anything pink that isnt actually held down right now
|
||||
//so we make an AND adapter and combine it using immediate & sticky
|
||||
var autoString = MakeStringFor(Global.StickyXORAdapter.Source.Xor(Global.AutofireStickyXORAdapter).And(Global.AutofireStickyXORAdapter));
|
||||
g.DrawString(autoString, MessageFont, autoColor, x, y);
|
||||
|
||||
var autoString = InputStrSticky();
|
||||
g.DrawString(autoString, MessageFont, Color.Pink, x, y);
|
||||
//recolor everything that's changed from the previous input
|
||||
var immediateOverlay = MakeIntersectImmediatePrevious();
|
||||
g.DrawString(immediateOverlay, MessageFont, changedColor, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,5 +24,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
public static GLManager GLManager;
|
||||
|
||||
public static int ExitCode;
|
||||
public static Communication.HttpCommunication httpCommunication = new Communication.HttpCommunication();
|
||||
public static Communication.SocketServer socketServer = new Communication.SocketServer();
|
||||
public static Communication.MemoryMappedFiles memoryMappedFiles = new Communication.MemoryMappedFiles();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -165,11 +165,19 @@ namespace BizHawk.Client.EmuHawk
|
|||
public IEnumerable<Tuple<string, float>> GetFloats()
|
||||
{
|
||||
var g = state.Gamepad;
|
||||
const float f = 3.2768f;
|
||||
|
||||
//constant for adapting a +/- 32768 range to a +/-10000-based range
|
||||
const float f = 32768 / 10000.0f;
|
||||
|
||||
//constant for adapting a 0-255 range to a 0-10000-based range
|
||||
const float f255 = 255 / 10000.0f;
|
||||
|
||||
yield return new Tuple<string, float>("LeftThumbX", g.sThumbLX / f);
|
||||
yield return new Tuple<string, float>("LeftThumbY", g.sThumbLY / f);
|
||||
yield return new Tuple<string, float>("RightThumbX", g.sThumbRX / f);
|
||||
yield return new Tuple<string, float>("RightThumbY", g.sThumbRY / f);
|
||||
yield return new Tuple<string, float>("LeftTrigger", g.bLeftTrigger / f255);
|
||||
yield return new Tuple<string, float>("RightTrigger", g.bRightTrigger / f255);
|
||||
yield break;
|
||||
}
|
||||
|
||||
|
|
|
@ -194,9 +194,12 @@
|
|||
this.MgbaCoreMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.Atari7800HawkCoreMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.SGBCoreSubmenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.SgbBsnesMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.SgbBsnesMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.SgbSameBoyMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.GBInSGBMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.GBCoreSubmenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.GBGambatteMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.GBGBHawkMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.GBInSGBMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem16 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.allowGameDBCoreOverridesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator();
|
||||
|
@ -271,7 +274,8 @@
|
|||
this.SMSregionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.SMSregionExportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.SMSregionJapanToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.SMSregionAutoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.SMSregionKoreaToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.SMSregionAutoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.SMSdisplayToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.SMSdisplayNtscToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.SMSdisplayPalToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
|
@ -330,7 +334,8 @@
|
|||
this.ColecoSubMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ColecoControllerSettingsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ColecoSkipBiosMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.N64SubMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ColecoUseSGMMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.N64SubMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.N64PluginSettingsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.N64ControllerSettingsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator23 = new System.Windows.Forms.ToolStripSeparator();
|
||||
|
@ -447,6 +452,7 @@
|
|||
this.SMSControllerPaddleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.SMSControllerLightPhaserToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.SMSControllerSportsPadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.SMSControllerKeyboardToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.MainformMenu.SuspendLayout();
|
||||
this.MainStatusBar.SuspendLayout();
|
||||
this.MainFormContextMenu.SuspendLayout();
|
||||
|
@ -1810,7 +1816,8 @@
|
|||
this.CoreSNESSubMenu,
|
||||
this.GbaCoreSubMenu,
|
||||
this.SGBCoreSubmenu,
|
||||
this.GBInSGBMenuItem,
|
||||
this.GBCoreSubmenu,
|
||||
this.GBInSGBMenuItem,
|
||||
this.toolStripMenuItem16,
|
||||
this.allowGameDBCoreOverridesToolStripMenuItem,
|
||||
this.toolStripSeparator8,
|
||||
|
@ -1908,10 +1915,20 @@
|
|||
this.SGBCoreSubmenu.Size = new System.Drawing.Size(239, 22);
|
||||
this.SGBCoreSubmenu.Text = "SGB";
|
||||
this.SGBCoreSubmenu.DropDownOpened += new System.EventHandler(this.SGBCoreSubmenu_DropDownOpened);
|
||||
//
|
||||
// SgbBsnesMenuItem
|
||||
//
|
||||
this.SgbBsnesMenuItem.Name = "SgbBsnesMenuItem";
|
||||
//
|
||||
// GBCoreSubmenu
|
||||
//
|
||||
this.GBCoreSubmenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.GBGambatteMenuItem,
|
||||
this.GBGBHawkMenuItem});
|
||||
this.GBCoreSubmenu.Name = "GBCoreSubmenu";
|
||||
this.GBCoreSubmenu.Size = new System.Drawing.Size(239, 22);
|
||||
this.GBCoreSubmenu.Text = "GB";
|
||||
this.GBCoreSubmenu.DropDownOpened += new System.EventHandler(this.GBCoreSubmenu_DropDownOpened);
|
||||
//
|
||||
// SgbBsnesMenuItem
|
||||
//
|
||||
this.SgbBsnesMenuItem.Name = "SgbBsnesMenuItem";
|
||||
this.SgbBsnesMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.SgbBsnesMenuItem.Text = "BSNES";
|
||||
this.SgbBsnesMenuItem.Click += new System.EventHandler(this.SgbCorePick_Click);
|
||||
|
@ -1922,10 +1939,24 @@
|
|||
this.SgbSameBoyMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.SgbSameBoyMenuItem.Text = "SameBoy";
|
||||
this.SgbSameBoyMenuItem.Click += new System.EventHandler(this.SgbCorePick_Click);
|
||||
//
|
||||
// GBInSGBMenuItem
|
||||
//
|
||||
this.GBInSGBMenuItem.Name = "GBInSGBMenuItem";
|
||||
//
|
||||
// GBGambatteMenuItem
|
||||
//
|
||||
this.GBGambatteMenuItem.Name = "GBGambatteMenuItem";
|
||||
this.GBGambatteMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.GBGambatteMenuItem.Text = "Gambatte";
|
||||
this.GBGambatteMenuItem.Click += new System.EventHandler(this.GBCorePick_Click);
|
||||
//
|
||||
// GBGBHawkMenuItem
|
||||
//
|
||||
this.GBGBHawkMenuItem.Name = "GBGBHawkMenuItem";
|
||||
this.GBGBHawkMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.GBGBHawkMenuItem.Text = "GBHawk";
|
||||
this.GBGBHawkMenuItem.Click += new System.EventHandler(this.GBCorePick_Click);
|
||||
//
|
||||
// GBInSGBMenuItem
|
||||
//
|
||||
this.GBInSGBMenuItem.Name = "GBInSGBMenuItem";
|
||||
this.GBInSGBMenuItem.Size = new System.Drawing.Size(239, 22);
|
||||
this.GBInSGBMenuItem.Text = "GB in SGB";
|
||||
this.GBInSGBMenuItem.Click += new System.EventHandler(this.GbInSgbMenuItem_Click);
|
||||
|
@ -2505,7 +2536,8 @@
|
|||
this.SMSregionToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.SMSregionExportToolStripMenuItem,
|
||||
this.SMSregionJapanToolStripMenuItem,
|
||||
this.SMSregionAutoToolStripMenuItem});
|
||||
this.SMSregionKoreaToolStripMenuItem,
|
||||
this.SMSregionAutoToolStripMenuItem});
|
||||
this.SMSregionToolStripMenuItem.Name = "SMSregionToolStripMenuItem";
|
||||
this.SMSregionToolStripMenuItem.Size = new System.Drawing.Size(277, 22);
|
||||
this.SMSregionToolStripMenuItem.Text = "Region";
|
||||
|
@ -2523,10 +2555,17 @@
|
|||
this.SMSregionJapanToolStripMenuItem.Size = new System.Drawing.Size(107, 22);
|
||||
this.SMSregionJapanToolStripMenuItem.Text = "Japan";
|
||||
this.SMSregionJapanToolStripMenuItem.Click += new System.EventHandler(this.SMS_RegionJapan_Click);
|
||||
//
|
||||
// SMSregionAutoToolStripMenuItem
|
||||
//
|
||||
this.SMSregionAutoToolStripMenuItem.Name = "SMSregionAutoToolStripMenuItem";
|
||||
//
|
||||
// SMSregionKoreaToolStripMenuItem
|
||||
//
|
||||
this.SMSregionKoreaToolStripMenuItem.Name = "SMSregionKoreaToolStripMenuItem";
|
||||
this.SMSregionKoreaToolStripMenuItem.Size = new System.Drawing.Size(107, 22);
|
||||
this.SMSregionKoreaToolStripMenuItem.Text = "Korea";
|
||||
this.SMSregionKoreaToolStripMenuItem.Click += new System.EventHandler(this.SMS_RegionKorea_Click);
|
||||
//
|
||||
// SMSregionAutoToolStripMenuItem
|
||||
//
|
||||
this.SMSregionAutoToolStripMenuItem.Name = "SMSregionAutoToolStripMenuItem";
|
||||
this.SMSregionAutoToolStripMenuItem.Size = new System.Drawing.Size(107, 22);
|
||||
this.SMSregionAutoToolStripMenuItem.Text = "Auto";
|
||||
this.SMSregionAutoToolStripMenuItem.Click += new System.EventHandler(this.SMS_RegionAuto_Click);
|
||||
|
@ -2556,7 +2595,8 @@
|
|||
this.SMSControllerStandardToolStripMenuItem,
|
||||
this.SMSControllerPaddleToolStripMenuItem,
|
||||
this.SMSControllerLightPhaserToolStripMenuItem,
|
||||
this.SMSControllerSportsPadToolStripMenuItem});
|
||||
this.SMSControllerSportsPadToolStripMenuItem,
|
||||
this.SMSControllerKeyboardToolStripMenuItem});
|
||||
//
|
||||
// SMSControllerStandardToolStripMenuItem
|
||||
//
|
||||
|
@ -2581,6 +2621,12 @@
|
|||
this.SMSControllerSportsPadToolStripMenuItem.Name = "SMSControllerSportsPadToolStripMenuItem";
|
||||
this.SMSControllerSportsPadToolStripMenuItem.Text = "Sports Pad";
|
||||
this.SMSControllerSportsPadToolStripMenuItem.Click += new System.EventHandler(this.SMSControllerSportsPadToolStripMenuItem_Click);
|
||||
//
|
||||
// SMSControllerKeyboardToolStripMenuItem
|
||||
//
|
||||
this.SMSControllerKeyboardToolStripMenuItem.Name = "SMSControllerKeyboardToolStripMenuItem";
|
||||
this.SMSControllerKeyboardToolStripMenuItem.Text = "Keyboard";
|
||||
this.SMSControllerKeyboardToolStripMenuItem.Click += new System.EventHandler(this.SMSControllerKeyboardToolStripMenuItem_Click);
|
||||
|
||||
//
|
||||
// SMSdisplayPalToolStripMenuItem
|
||||
|
@ -2989,7 +3035,8 @@
|
|||
this.ColecoSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.ColecoControllerSettingsMenuItem,
|
||||
this.toolStripSeparator35,
|
||||
this.ColecoSkipBiosMenuItem});
|
||||
this.ColecoSkipBiosMenuItem,
|
||||
this.ColecoUseSGMMenuItem});
|
||||
this.ColecoSubMenu.Name = "ColecoSubMenu";
|
||||
this.ColecoSubMenu.Size = new System.Drawing.Size(56, 19);
|
||||
this.ColecoSubMenu.Text = "&Coleco";
|
||||
|
@ -3014,10 +3061,17 @@
|
|||
this.ColecoSkipBiosMenuItem.Size = new System.Drawing.Size(253, 22);
|
||||
this.ColecoSkipBiosMenuItem.Text = "&Skip BIOS intro (When Applicable)";
|
||||
this.ColecoSkipBiosMenuItem.Click += new System.EventHandler(this.ColecoSkipBiosMenuItem_Click);
|
||||
//
|
||||
// N64SubMenu
|
||||
//
|
||||
this.N64SubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
//
|
||||
// ColecoUseSGMMenuItem
|
||||
//
|
||||
this.ColecoUseSGMMenuItem.Name = "ColecoUseSGMMenuItem";
|
||||
this.ColecoUseSGMMenuItem.Size = new System.Drawing.Size(253, 22);
|
||||
this.ColecoUseSGMMenuItem.Text = "&Use the Super Game Module";
|
||||
this.ColecoUseSGMMenuItem.Click += new System.EventHandler(this.ColecoUseSGMMenuItem_Click);
|
||||
//
|
||||
// N64SubMenu
|
||||
//
|
||||
this.N64SubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.N64PluginSettingsMenuItem,
|
||||
this.N64ControllerSettingsMenuItem,
|
||||
this.toolStripSeparator23,
|
||||
|
@ -4212,6 +4266,7 @@
|
|||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator28;
|
||||
private System.Windows.Forms.ToolStripMenuItem ColecoSubMenu;
|
||||
private System.Windows.Forms.ToolStripMenuItem ColecoSkipBiosMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem ColecoUseSGMMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem ColecoControllerSettingsMenuItem;
|
||||
private System.Windows.Forms.ToolStripStatusLabel LedLightStatusLabel;
|
||||
private System.Windows.Forms.ToolStripMenuItem GBASubMenu;
|
||||
|
@ -4262,6 +4317,7 @@
|
|||
private System.Windows.Forms.ToolStripMenuItem SMSregionToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem SMSregionExportToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem SMSregionJapanToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem SMSregionKoreaToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem SMSregionAutoToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem SMSdisplayToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem SMSdisplayNtscToolStripMenuItem;
|
||||
|
@ -4407,6 +4463,9 @@
|
|||
private System.Windows.Forms.ToolStripMenuItem SGBCoreSubmenu;
|
||||
private System.Windows.Forms.ToolStripMenuItem SgbBsnesMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem SgbSameBoyMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem GBCoreSubmenu;
|
||||
private System.Windows.Forms.ToolStripMenuItem GBGambatteMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem GBGBHawkMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem pCFXToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem preferencesToolStripMenuItem3;
|
||||
private System.Windows.Forms.ToolStripMenuItem SMSControllerToolStripMenuItem;
|
||||
|
@ -4414,5 +4473,6 @@
|
|||
private System.Windows.Forms.ToolStripMenuItem SMSControllerPaddleToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem SMSControllerLightPhaserToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem SMSControllerSportsPadToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem SMSControllerKeyboardToolStripMenuItem;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1244,6 +1244,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
SgbSameBoyMenuItem.Checked = !Global.Config.SGB_UseBsnes;
|
||||
}
|
||||
|
||||
private void GBCoreSubmenu_DropDownOpened(object sender, EventArgs e)
|
||||
{
|
||||
GBGambatteMenuItem.Checked = !Global.Config.GB_UseGBHawk;
|
||||
GBGBHawkMenuItem.Checked = Global.Config.GB_UseGBHawk;
|
||||
}
|
||||
|
||||
private void SgbCorePick_Click(object sender, EventArgs e)
|
||||
{
|
||||
Global.Config.SGB_UseBsnes ^= true;
|
||||
|
@ -1254,6 +1260,16 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
private void GBCorePick_Click(object sender, EventArgs e)
|
||||
{
|
||||
Global.Config.GB_UseGBHawk ^= true;
|
||||
// TODO: only flag if one of these cores
|
||||
if (!Emulator.IsNull())
|
||||
{
|
||||
FlagNeedsReboot();
|
||||
}
|
||||
}
|
||||
|
||||
private void GbInSgbMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Global.Config.GB_AsSGB ^= true;
|
||||
|
@ -1741,6 +1757,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
var ss = ((SMS)Emulator).GetSyncSettings();
|
||||
SMSregionExportToolStripMenuItem.Checked = ss.ConsoleRegion == "Export";
|
||||
SMSregionJapanToolStripMenuItem.Checked = ss.ConsoleRegion == "Japan";
|
||||
SMSregionKoreaToolStripMenuItem.Checked = ss.ConsoleRegion == "Korea";
|
||||
SMSregionAutoToolStripMenuItem.Checked = ss.ConsoleRegion == "Auto";
|
||||
SMSdisplayNtscToolStripMenuItem.Checked = ss.DisplayType == "NTSC";
|
||||
SMSdisplayPalToolStripMenuItem.Checked = ss.DisplayType == "PAL";
|
||||
|
@ -1749,6 +1766,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
SMSControllerPaddleToolStripMenuItem.Checked = ss.ControllerType == "Paddle";
|
||||
SMSControllerLightPhaserToolStripMenuItem.Checked = ss.ControllerType == "Light Phaser";
|
||||
SMSControllerSportsPadToolStripMenuItem.Checked = ss.ControllerType == "Sports Pad";
|
||||
SMSControllerKeyboardToolStripMenuItem.Checked = ss.ControllerType == "Keyboard";
|
||||
SMSenableBIOSToolStripMenuItem.Checked = ss.UseBIOS;
|
||||
SMSEnableFMChipMenuItem.Checked = ss.EnableFM;
|
||||
SMSOverclockMenuItem.Checked = ss.AllowOverlock;
|
||||
|
@ -1797,6 +1815,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
PutCoreSyncSettings(ss);
|
||||
}
|
||||
|
||||
private void SMS_RegionKorea_Click(object sender, EventArgs e)
|
||||
{
|
||||
var ss = ((SMS)Emulator).GetSyncSettings();
|
||||
ss.ConsoleRegion = "Korea";
|
||||
PutCoreSyncSettings(ss);
|
||||
}
|
||||
|
||||
private void SMS_RegionAuto_Click(object sender, EventArgs e)
|
||||
{
|
||||
var ss = ((SMS)Emulator).GetSyncSettings();
|
||||
|
@ -1930,6 +1955,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
s.ControllerType = "Sports Pad";
|
||||
PutCoreSyncSettings(s);
|
||||
}
|
||||
|
||||
private void SMSControllerKeyboardToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var s = ((SMS)Emulator).GetSyncSettings();
|
||||
s.ControllerType = "Keyboard";
|
||||
PutCoreSyncSettings(s);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -2174,6 +2206,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
var ss = ((ColecoVision)Emulator).GetSyncSettings();
|
||||
ColecoSkipBiosMenuItem.Checked = ss.SkipBiosIntro;
|
||||
ColecoUseSGMMenuItem.Checked = ss.UseSGM;
|
||||
ColecoControllerSettingsMenuItem.Enabled = !Global.MovieSession.Movie.IsActive;
|
||||
}
|
||||
|
||||
|
@ -2184,6 +2217,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
PutCoreSyncSettings(ss);
|
||||
}
|
||||
|
||||
private void ColecoUseSGMMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var ss = ((ColecoVision)Emulator).GetSyncSettings();
|
||||
ss.UseSGM ^= true;
|
||||
PutCoreSyncSettings(ss);
|
||||
}
|
||||
|
||||
private void ColecoControllerSettingsMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
new ColecoControllerSettings().ShowDialog();
|
||||
|
|
|
@ -155,7 +155,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
};
|
||||
|
||||
argParse.parseArguments(args);
|
||||
argParse.ParseArguments(args);
|
||||
|
||||
Database.LoadDatabase(Path.Combine(PathManager.GetExeDirectoryAbsolute(), "gamedb", "gamedb.txt"));
|
||||
|
||||
|
@ -609,7 +609,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private bool IsTurboSeeking => PauseOnFrame.HasValue && Global.Config.TurboSeek;
|
||||
|
||||
private bool IsTurboing => Global.ClientControls["Turbo"] || IsTurboSeeking;
|
||||
public bool IsTurboing => Global.ClientControls["Turbo"] || IsTurboSeeking;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -2969,11 +2969,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
Global.CheatList.Pulse();
|
||||
|
||||
if (!PauseAvi)
|
||||
{
|
||||
AvFrameAdvance();
|
||||
}
|
||||
|
||||
if (IsLagFrame && Global.Config.AutofireLagFrames)
|
||||
{
|
||||
Global.AutoFireController.IncrementStarts();
|
||||
|
@ -2990,13 +2985,18 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
if (IsTurboing)
|
||||
{
|
||||
GlobalWin.Tools.FastUpdateAfter();
|
||||
GlobalWin.Tools.FastUpdateAfter(SuppressLua);
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateToolsAfter(SuppressLua);
|
||||
}
|
||||
|
||||
if (!PauseAvi)
|
||||
{
|
||||
AvFrameAdvance();
|
||||
}
|
||||
|
||||
if (GlobalWin.Tools.IsLoaded<TAStudio>() &&
|
||||
GlobalWin.Tools.TAStudio.LastPositionFrame == Emulator.Frame)
|
||||
{
|
||||
|
@ -3854,6 +3854,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
UpdateStatusSlots();
|
||||
CurrentlyOpenRom = null;
|
||||
CurrentlyOpenRomArgs = null;
|
||||
_currentlyOpenRomPoopForAdvancedLoaderPleaseRefactorMe = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,19 +30,22 @@ namespace BizHawk.Client.EmuHawk
|
|||
//but oddly it lets us proceed and we'll then catch it here
|
||||
var d3dx9 = Win32.LoadLibrary("d3dx9_43.dll");
|
||||
var vc2015 = Win32.LoadLibrary("vcruntime140.dll");
|
||||
var vc2012 = Win32.LoadLibrary("msvcr120.dll"); //TODO - check version?
|
||||
var vc2010 = Win32.LoadLibrary("msvcr100.dll"); //TODO - check version?
|
||||
var vc2010p = Win32.LoadLibrary("msvcp100.dll");
|
||||
bool fail = false, warn = false;
|
||||
warn |= d3dx9 == IntPtr.Zero;
|
||||
fail |= vc2015 == IntPtr.Zero;
|
||||
fail |= vc2010 == IntPtr.Zero;
|
||||
fail |= vc2012 == IntPtr.Zero;
|
||||
fail |= vc2010p == IntPtr.Zero;
|
||||
if (fail || warn)
|
||||
{
|
||||
var sw = new System.IO.StringWriter();
|
||||
sw.WriteLine("[ OK ] .Net 4.0 (You couldn't even get here without it)");
|
||||
sw.WriteLine("[ OK ] .Net 4.6.1 (You couldn't even get here without it)");
|
||||
sw.WriteLine("[{0}] Direct3d 9", d3dx9 == IntPtr.Zero ? "FAIL" : " OK ");
|
||||
sw.WriteLine("[{0}] Visual C++ 2010 SP1 Runtime", (vc2010 == IntPtr.Zero || vc2010p == IntPtr.Zero) ? "FAIL" : " OK ");
|
||||
sw.WriteLine("[{0}] Visual C++ 2012 Runtime", (vc2012 == IntPtr.Zero) ? "FAIL" : " OK ");
|
||||
sw.WriteLine("[{0}] Visual C++ 2015 Runtime", (vc2015 == IntPtr.Zero) ? "FAIL" : " OK ");
|
||||
var str = sw.ToString();
|
||||
var box = new BizHawk.Client.EmuHawk.CustomControls.PrereqsAlert(!fail);
|
||||
|
@ -55,6 +58,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
Win32.FreeLibrary(d3dx9);
|
||||
Win32.FreeLibrary(vc2015);
|
||||
Win32.FreeLibrary(vc2012);
|
||||
Win32.FreeLibrary(vc2010);
|
||||
Win32.FreeLibrary(vc2010p);
|
||||
|
||||
|
|
|
@ -1300,7 +1300,7 @@
|
|||
<value>..\images\alt_about_image.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="SaturnController" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\images\controllerimages\saturncontroller.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
<value>..\images\ControllerImages\SaturnController.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="ts_v_piano_02_green_blue" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\images\tastudio\ts_v_piano_02_green_blue.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
|
|
|
@ -117,6 +117,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public int CalculateSamplesNeeded()
|
||||
{
|
||||
if (_deviceBuffer.Status == BufferStatus.BufferLost) return 0;
|
||||
|
||||
long currentWriteTime = Stopwatch.GetTimestamp();
|
||||
int playCursor = _deviceBuffer.CurrentPlayPosition;
|
||||
int writeCursor = _deviceBuffer.CurrentWritePosition;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
using System.Windows.Forms;
|
||||
using System.Reflection;
|
||||
using System.ComponentModel;
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
|
@ -31,6 +33,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (_s != null)
|
||||
{
|
||||
propertyGrid1.SelectedObject = _s;
|
||||
ChangeDescriptionHeight(propertyGrid1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -40,6 +43,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (_ss != null)
|
||||
{
|
||||
propertyGrid2.SelectedObject = _ss;
|
||||
ChangeDescriptionHeight(propertyGrid2);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -57,6 +61,36 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
}
|
||||
|
||||
private static void ChangeDescriptionHeight(PropertyGrid grid)
|
||||
{
|
||||
if (grid == null)
|
||||
throw new ArgumentNullException("grid");
|
||||
|
||||
int maxlen = 0;
|
||||
string desc = "";
|
||||
|
||||
foreach (PropertyDescriptor property in TypeDescriptor.GetProperties(grid.SelectedObject))
|
||||
{
|
||||
if (property.Description.Length > maxlen)
|
||||
{
|
||||
maxlen = property.Description.Length;
|
||||
desc = property.Description;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (Control control in grid.Controls)
|
||||
{
|
||||
if (control.GetType().Name == "DocComment")
|
||||
{
|
||||
FieldInfo field = control.GetType().GetField("userSized", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
field.SetValue(control, true);
|
||||
int height = (int)System.Drawing.Graphics.FromHwnd(control.Handle).MeasureString(desc, control.Font, grid.Width).Height;
|
||||
control.Height = Math.Max(20, height) + 16; // magic for now
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OkBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_s != null && settingschanged)
|
||||
|
|
|
@ -520,7 +520,7 @@
|
|||
this.label47.Name = "label47";
|
||||
this.label47.Size = new System.Drawing.Size(275, 13);
|
||||
this.label47.TabIndex = 14;
|
||||
this.label47.Text = "(Glide64mk2 is newer and is recommended over Glide64)";
|
||||
this.label47.Text = "(GLideN64 is the newest pluging and has the highest compatibility)";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
|
|
|
@ -28,123 +28,238 @@
|
|||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.OK = new System.Windows.Forms.Button();
|
||||
this.Cancel = new System.Windows.Forms.Button();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.DispBG2 = new System.Windows.Forms.CheckBox();
|
||||
this.DispOBJ2 = new System.Windows.Forms.CheckBox();
|
||||
this.DispBG1 = new System.Windows.Forms.CheckBox();
|
||||
this.DispOBJ1 = new System.Windows.Forms.CheckBox();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// OK
|
||||
//
|
||||
this.OK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.OK.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
this.OK.Location = new System.Drawing.Point(205, 96);
|
||||
this.OK.Name = "OK";
|
||||
this.OK.Size = new System.Drawing.Size(75, 23);
|
||||
this.OK.TabIndex = 4;
|
||||
this.OK.Text = "&OK";
|
||||
this.OK.UseVisualStyleBackColor = true;
|
||||
this.OK.Click += new System.EventHandler(this.Ok_Click);
|
||||
//
|
||||
// Cancel
|
||||
//
|
||||
this.Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.Cancel.Location = new System.Drawing.Point(286, 96);
|
||||
this.Cancel.Name = "Cancel";
|
||||
this.Cancel.Size = new System.Drawing.Size(75, 23);
|
||||
this.Cancel.TabIndex = 5;
|
||||
this.Cancel.Text = "&Cancel";
|
||||
this.Cancel.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.DispBG2);
|
||||
this.groupBox1.Controls.Add(this.DispOBJ2);
|
||||
this.groupBox1.Controls.Add(this.DispBG1);
|
||||
this.groupBox1.Controls.Add(this.DispOBJ1);
|
||||
this.groupBox1.Location = new System.Drawing.Point(9, 12);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(352, 73);
|
||||
this.groupBox1.TabIndex = 2;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Background and Sprites";
|
||||
//
|
||||
// DispBG2
|
||||
//
|
||||
this.DispBG2.AutoSize = true;
|
||||
this.DispBG2.Checked = true;
|
||||
this.DispBG2.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.DispBG2.Location = new System.Drawing.Point(108, 43);
|
||||
this.DispBG2.Name = "DispBG2";
|
||||
this.DispBG2.Size = new System.Drawing.Size(84, 17);
|
||||
this.DispBG2.TabIndex = 3;
|
||||
this.DispBG2.Text = "Display BG2";
|
||||
this.DispBG2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// DispOBJ2
|
||||
//
|
||||
this.DispOBJ2.AutoSize = true;
|
||||
this.DispOBJ2.Checked = true;
|
||||
this.DispOBJ2.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.DispOBJ2.Location = new System.Drawing.Point(108, 21);
|
||||
this.DispOBJ2.Name = "DispOBJ2";
|
||||
this.DispOBJ2.Size = new System.Drawing.Size(89, 17);
|
||||
this.DispOBJ2.TabIndex = 2;
|
||||
this.DispOBJ2.Text = "Display OBJ2";
|
||||
this.DispOBJ2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// DispBG1
|
||||
//
|
||||
this.DispBG1.AutoSize = true;
|
||||
this.DispBG1.Checked = true;
|
||||
this.DispBG1.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.DispBG1.Location = new System.Drawing.Point(9, 43);
|
||||
this.DispBG1.Name = "DispBG1";
|
||||
this.DispBG1.Size = new System.Drawing.Size(84, 17);
|
||||
this.DispBG1.TabIndex = 1;
|
||||
this.DispBG1.Text = "Display BG1";
|
||||
this.DispBG1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// DispOBJ1
|
||||
//
|
||||
this.DispOBJ1.AutoSize = true;
|
||||
this.DispOBJ1.Checked = true;
|
||||
this.DispOBJ1.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.DispOBJ1.Location = new System.Drawing.Point(9, 21);
|
||||
this.DispOBJ1.Name = "DispOBJ1";
|
||||
this.DispOBJ1.Size = new System.Drawing.Size(89, 17);
|
||||
this.DispOBJ1.TabIndex = 0;
|
||||
this.DispOBJ1.Text = "Display OBJ1";
|
||||
this.DispOBJ1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// PCEGraphicsConfig
|
||||
//
|
||||
this.AcceptButton = this.OK;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.CancelButton = this.Cancel;
|
||||
this.ClientSize = new System.Drawing.Size(373, 128);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.Controls.Add(this.Cancel);
|
||||
this.Controls.Add(this.OK);
|
||||
this.MaximizeBox = false;
|
||||
this.MaximumSize = new System.Drawing.Size(389, 433);
|
||||
this.MinimizeBox = false;
|
||||
this.MinimumSize = new System.Drawing.Size(389, 166);
|
||||
this.Name = "PCEGraphicsConfig";
|
||||
this.ShowIcon = false;
|
||||
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "PC Engine Graphics Settings";
|
||||
this.Load += new System.EventHandler(this.PCEGraphicsConfig_Load);
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.OK = new System.Windows.Forms.Button();
|
||||
this.Cancel = new System.Windows.Forms.Button();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.DispBG2 = new System.Windows.Forms.CheckBox();
|
||||
this.DispOBJ2 = new System.Windows.Forms.CheckBox();
|
||||
this.DispBG1 = new System.Windows.Forms.CheckBox();
|
||||
this.DispOBJ1 = new System.Windows.Forms.CheckBox();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.btnAreaFull = new System.Windows.Forms.Button();
|
||||
this.btnAreaStandard = new System.Windows.Forms.Button();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.NTSC_LastLineNumeric = new System.Windows.Forms.NumericUpDown();
|
||||
this.NTSC_FirstLineNumeric = new System.Windows.Forms.NumericUpDown();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NTSC_LastLineNumeric)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NTSC_FirstLineNumeric)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// OK
|
||||
//
|
||||
this.OK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.OK.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
this.OK.Location = new System.Drawing.Point(205, 279);
|
||||
this.OK.Name = "OK";
|
||||
this.OK.Size = new System.Drawing.Size(75, 23);
|
||||
this.OK.TabIndex = 4;
|
||||
this.OK.Text = "&OK";
|
||||
this.OK.UseVisualStyleBackColor = true;
|
||||
this.OK.Click += new System.EventHandler(this.Ok_Click);
|
||||
//
|
||||
// Cancel
|
||||
//
|
||||
this.Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.Cancel.Location = new System.Drawing.Point(286, 279);
|
||||
this.Cancel.Name = "Cancel";
|
||||
this.Cancel.Size = new System.Drawing.Size(75, 23);
|
||||
this.Cancel.TabIndex = 5;
|
||||
this.Cancel.Text = "&Cancel";
|
||||
this.Cancel.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.DispBG2);
|
||||
this.groupBox1.Controls.Add(this.DispOBJ2);
|
||||
this.groupBox1.Controls.Add(this.DispBG1);
|
||||
this.groupBox1.Controls.Add(this.DispOBJ1);
|
||||
this.groupBox1.Location = new System.Drawing.Point(9, 12);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(352, 73);
|
||||
this.groupBox1.TabIndex = 2;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Background and Sprites";
|
||||
//
|
||||
// DispBG2
|
||||
//
|
||||
this.DispBG2.AutoSize = true;
|
||||
this.DispBG2.Checked = true;
|
||||
this.DispBG2.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.DispBG2.Location = new System.Drawing.Point(108, 43);
|
||||
this.DispBG2.Name = "DispBG2";
|
||||
this.DispBG2.Size = new System.Drawing.Size(84, 17);
|
||||
this.DispBG2.TabIndex = 3;
|
||||
this.DispBG2.Text = "Display BG2";
|
||||
this.DispBG2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// DispOBJ2
|
||||
//
|
||||
this.DispOBJ2.AutoSize = true;
|
||||
this.DispOBJ2.Checked = true;
|
||||
this.DispOBJ2.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.DispOBJ2.Location = new System.Drawing.Point(108, 21);
|
||||
this.DispOBJ2.Name = "DispOBJ2";
|
||||
this.DispOBJ2.Size = new System.Drawing.Size(89, 17);
|
||||
this.DispOBJ2.TabIndex = 2;
|
||||
this.DispOBJ2.Text = "Display OBJ2";
|
||||
this.DispOBJ2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// DispBG1
|
||||
//
|
||||
this.DispBG1.AutoSize = true;
|
||||
this.DispBG1.Checked = true;
|
||||
this.DispBG1.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.DispBG1.Location = new System.Drawing.Point(9, 43);
|
||||
this.DispBG1.Name = "DispBG1";
|
||||
this.DispBG1.Size = new System.Drawing.Size(84, 17);
|
||||
this.DispBG1.TabIndex = 1;
|
||||
this.DispBG1.Text = "Display BG1";
|
||||
this.DispBG1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// DispOBJ1
|
||||
//
|
||||
this.DispOBJ1.AutoSize = true;
|
||||
this.DispOBJ1.Checked = true;
|
||||
this.DispOBJ1.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.DispOBJ1.Location = new System.Drawing.Point(9, 21);
|
||||
this.DispOBJ1.Name = "DispOBJ1";
|
||||
this.DispOBJ1.Size = new System.Drawing.Size(89, 17);
|
||||
this.DispOBJ1.TabIndex = 0;
|
||||
this.DispOBJ1.Text = "Display OBJ1";
|
||||
this.DispOBJ1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.groupBox2.Controls.Add(this.label5);
|
||||
this.groupBox2.Controls.Add(this.btnAreaFull);
|
||||
this.groupBox2.Controls.Add(this.btnAreaStandard);
|
||||
this.groupBox2.Controls.Add(this.label4);
|
||||
this.groupBox2.Controls.Add(this.label3);
|
||||
this.groupBox2.Controls.Add(this.NTSC_LastLineNumeric);
|
||||
this.groupBox2.Controls.Add(this.NTSC_FirstLineNumeric);
|
||||
this.groupBox2.Location = new System.Drawing.Point(9, 100);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Size = new System.Drawing.Size(352, 150);
|
||||
this.groupBox2.TabIndex = 6;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "Drawing Area";
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(62, 22);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(36, 13);
|
||||
this.label5.TabIndex = 41;
|
||||
this.label5.Text = "NTSC";
|
||||
//
|
||||
// btnAreaFull
|
||||
//
|
||||
this.btnAreaFull.Location = new System.Drawing.Point(6, 115);
|
||||
this.btnAreaFull.Name = "btnAreaFull";
|
||||
this.btnAreaFull.Size = new System.Drawing.Size(100, 23);
|
||||
this.btnAreaFull.TabIndex = 40;
|
||||
this.btnAreaFull.Text = "Full [0,262]";
|
||||
this.btnAreaFull.UseVisualStyleBackColor = true;
|
||||
this.btnAreaFull.Click += new System.EventHandler(this.BtnAreaFull_Click);
|
||||
//
|
||||
// btnAreaStandard
|
||||
//
|
||||
this.btnAreaStandard.Location = new System.Drawing.Point(6, 92);
|
||||
this.btnAreaStandard.Name = "btnAreaStandard";
|
||||
this.btnAreaStandard.Size = new System.Drawing.Size(100, 23);
|
||||
this.btnAreaStandard.TabIndex = 35;
|
||||
this.btnAreaStandard.Text = "Standard [18,252]";
|
||||
this.btnAreaStandard.UseVisualStyleBackColor = true;
|
||||
this.btnAreaStandard.Click += new System.EventHandler(this.BtnAreaStandard_Click);
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(4, 69);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(49, 13);
|
||||
this.label4.TabIndex = 24;
|
||||
this.label4.Text = "Last line:";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(5, 43);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(48, 13);
|
||||
this.label3.TabIndex = 23;
|
||||
this.label3.Text = "First line:";
|
||||
//
|
||||
// NTSC_LastLineNumeric
|
||||
//
|
||||
this.NTSC_LastLineNumeric.Location = new System.Drawing.Point(59, 67);
|
||||
this.NTSC_LastLineNumeric.Maximum = new decimal(new int[] {
|
||||
262,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.NTSC_LastLineNumeric.Minimum = new decimal(new int[] {
|
||||
128,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.NTSC_LastLineNumeric.Name = "NTSC_LastLineNumeric";
|
||||
this.NTSC_LastLineNumeric.Size = new System.Drawing.Size(47, 20);
|
||||
this.NTSC_LastLineNumeric.TabIndex = 28;
|
||||
this.NTSC_LastLineNumeric.Value = new decimal(new int[] {
|
||||
128,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
//
|
||||
// NTSC_FirstLineNumeric
|
||||
//
|
||||
this.NTSC_FirstLineNumeric.Location = new System.Drawing.Point(59, 41);
|
||||
this.NTSC_FirstLineNumeric.Maximum = new decimal(new int[] {
|
||||
127,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.NTSC_FirstLineNumeric.Name = "NTSC_FirstLineNumeric";
|
||||
this.NTSC_FirstLineNumeric.Size = new System.Drawing.Size(47, 20);
|
||||
this.NTSC_FirstLineNumeric.TabIndex = 21;
|
||||
//
|
||||
// PCEGraphicsConfig
|
||||
//
|
||||
this.AcceptButton = this.OK;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.CancelButton = this.Cancel;
|
||||
this.ClientSize = new System.Drawing.Size(373, 311);
|
||||
this.Controls.Add(this.groupBox2);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.Controls.Add(this.Cancel);
|
||||
this.Controls.Add(this.OK);
|
||||
this.MaximizeBox = false;
|
||||
this.MaximumSize = new System.Drawing.Size(389, 433);
|
||||
this.MinimizeBox = false;
|
||||
this.MinimumSize = new System.Drawing.Size(389, 166);
|
||||
this.Name = "PCEGraphicsConfig";
|
||||
this.ShowIcon = false;
|
||||
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "PC Engine Graphics Settings";
|
||||
this.Load += new System.EventHandler(this.PCEGraphicsConfig_Load);
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
this.groupBox2.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NTSC_LastLineNumeric)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NTSC_FirstLineNumeric)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
|
@ -157,5 +272,13 @@
|
|||
private System.Windows.Forms.CheckBox DispOBJ2;
|
||||
private System.Windows.Forms.CheckBox DispBG1;
|
||||
private System.Windows.Forms.CheckBox DispOBJ1;
|
||||
private System.Windows.Forms.GroupBox groupBox2;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.Button btnAreaFull;
|
||||
private System.Windows.Forms.Button btnAreaStandard;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.NumericUpDown NTSC_LastLineNumeric;
|
||||
private System.Windows.Forms.NumericUpDown NTSC_FirstLineNumeric;
|
||||
}
|
||||
}
|
|
@ -21,6 +21,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
DispBG1.Checked = s.ShowBG1;
|
||||
DispOBJ2.Checked = s.ShowOBJ2;
|
||||
DispBG2.Checked = s.ShowBG2;
|
||||
NTSC_FirstLineNumeric.Value = s.Top_Line;
|
||||
NTSC_LastLineNumeric.Value = s.Bottom_Line;
|
||||
}
|
||||
|
||||
private void Ok_Click(object sender, EventArgs e)
|
||||
|
@ -31,8 +33,22 @@ namespace BizHawk.Client.EmuHawk
|
|||
s.ShowBG1 = DispBG1.Checked;
|
||||
s.ShowOBJ2 = DispOBJ2.Checked;
|
||||
s.ShowBG2 = DispBG2.Checked;
|
||||
s.Top_Line = (int)NTSC_FirstLineNumeric.Value;
|
||||
s.Bottom_Line = (int)NTSC_LastLineNumeric.Value;
|
||||
pce.PutSettings(s);
|
||||
Close();
|
||||
}
|
||||
|
||||
private void BtnAreaStandard_Click(object sender, EventArgs e)
|
||||
{
|
||||
NTSC_FirstLineNumeric.Value = 18;
|
||||
NTSC_LastLineNumeric.Value = 252;
|
||||
}
|
||||
|
||||
private void BtnAreaFull_Click(object sender, EventArgs e)
|
||||
{
|
||||
NTSC_FirstLineNumeric.Value = 0;
|
||||
NTSC_LastLineNumeric.Value = 262;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,9 +9,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
public Action Callback { get; set; }
|
||||
|
||||
public void Add(IDebuggable core, uint address, uint mask, MemoryCallbackType type)
|
||||
public void Add(IDebuggable core, string scope, uint address, uint mask, MemoryCallbackType type)
|
||||
{
|
||||
Add(new Breakpoint(core, Callback, address, mask, type));
|
||||
Add(new Breakpoint(core, scope, Callback, address, mask, type));
|
||||
}
|
||||
|
||||
public new void Clear()
|
||||
|
@ -69,8 +69,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
private bool _active;
|
||||
private readonly IDebuggable _core;
|
||||
|
||||
public Breakpoint(bool readOnly, IDebuggable core, Action callBack, uint address, uint mask, MemoryCallbackType type, bool enabled = true)
|
||||
public Breakpoint(bool readOnly, IDebuggable core, string scope, Action callBack, uint address, uint mask, MemoryCallbackType type, bool enabled = true)
|
||||
{
|
||||
Scope = scope;
|
||||
_core = core;
|
||||
Type = type;
|
||||
Callback = callBack;
|
||||
|
@ -82,8 +83,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
ReadOnly = readOnly;
|
||||
}
|
||||
|
||||
public Breakpoint(IDebuggable core, Action callBack, uint address, uint mask, MemoryCallbackType type, bool enabled = true)
|
||||
public Breakpoint(IDebuggable core, string scope, Action callBack, uint address, uint mask, MemoryCallbackType type, bool enabled = true)
|
||||
{
|
||||
Scope = scope;
|
||||
_core = core;
|
||||
Type = type;
|
||||
Callback = callBack;
|
||||
|
@ -94,8 +96,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
Active = enabled;
|
||||
}
|
||||
|
||||
public Breakpoint(string name, bool readOnly, IDebuggable core, Action callBack, uint address, uint mask, MemoryCallbackType type, bool enabled = true)
|
||||
public Breakpoint(string name, bool readOnly, IDebuggable core, string scope, Action callBack, uint address, uint mask, MemoryCallbackType type, bool enabled = true)
|
||||
{
|
||||
Scope = scope;
|
||||
_core = core;
|
||||
Type = type;
|
||||
Callback = callBack;
|
||||
|
@ -107,6 +110,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
ReadOnly = readOnly;
|
||||
}
|
||||
|
||||
public string Scope { get; }
|
||||
public Action Callback { get; }
|
||||
public uint? Address { get; set; }
|
||||
public uint? AddressMask { get; set; }
|
||||
|
@ -159,7 +163,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void AddCallback()
|
||||
{
|
||||
_core.MemoryCallbacks.Add(new MemoryCallback(Type, Name, Callback, Address, AddressMask));
|
||||
_core.MemoryCallbacks.Add(new MemoryCallback(Scope, Type, Name, Callback, Address, AddressMask));
|
||||
}
|
||||
|
||||
private void RemoveCallback()
|
||||
|
|
|
@ -144,7 +144,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public void AddBreakpoint(uint address, uint mask, MemoryCallbackType type)
|
||||
{
|
||||
_breakpoints.Add(Core, address, mask, type);
|
||||
_breakpoints.Add(Core, MemoryDomains.SystemBus.Name, address, mask, type);
|
||||
|
||||
BreakpointView.ItemCount = _breakpoints.Count;
|
||||
UpdateBreakpointRemoveButton();
|
||||
|
@ -157,7 +157,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
if (b.ShowHawkDialog() == DialogResult.OK)
|
||||
{
|
||||
_breakpoints.Add(Core, b.Address, b.AddressMask, b.BreakType);
|
||||
_breakpoints.Add(Core, MemoryDomains.SystemBus.Name, b.Address, b.AddressMask, b.BreakType);
|
||||
}
|
||||
|
||||
BreakpointView.ItemCount = _breakpoints.Count;
|
||||
|
@ -170,7 +170,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
public void AddSeekBreakpoint(uint pcVal, int pcBitSize)
|
||||
{
|
||||
var name = SeekName + pcVal.ToHexString(pcBitSize / 4);
|
||||
_breakpoints.Add(new Breakpoint(name, true, Core, SeekCallback, pcVal, 0xFFFFFFFF, MemoryCallbackType.Execute));
|
||||
_breakpoints.Add(new Breakpoint(name, true, Core, MemoryDomains.SystemBus.Name, SeekCallback, pcVal, 0xFFFFFFFF, MemoryCallbackType.Execute));
|
||||
}
|
||||
|
||||
public void RemoveCurrentSeek()
|
||||
|
@ -284,7 +284,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
if (b.ShowHawkDialog() == DialogResult.OK)
|
||||
{
|
||||
_breakpoints.Add(new Breakpoint(Core, breakpoint.Callback, b.Address, b.AddressMask, b.BreakType, breakpoint.Active));
|
||||
_breakpoints.Add(new Breakpoint(Core, MemoryDomains.SystemBus.Name, breakpoint.Callback, b.Address, b.AddressMask, b.BreakType, breakpoint.Active));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
[OptionalService]
|
||||
private IDisassemblable Disassembler { get; set; }
|
||||
|
||||
[OptionalService]
|
||||
[RequiredService]
|
||||
private IMemoryDomains MemoryDomains { get; set; }
|
||||
|
||||
private IMemoryCallbackSystem MemoryCallbacks { get { return Debuggable.MemoryCallbacks; } }
|
||||
|
|
|
@ -87,7 +87,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
_cgb = Gb.IsCGBMode();
|
||||
_lcdc = 0;
|
||||
|
||||
_memory = Gb.GetGPU();
|
||||
|
||||
tilespal = _memory.Bgpal;
|
||||
|
@ -129,7 +128,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
for (int x = 0; x < 8; x++) // right to left
|
||||
{
|
||||
int color = loplane & 1 | hiplane & 2;
|
||||
*dest-- = pal[color];
|
||||
*dest-- = (int)(pal[color] | 0xFF000000);
|
||||
loplane >>= 1;
|
||||
hiplane >>= 1;
|
||||
}
|
||||
|
@ -161,7 +160,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
for (int x = 0; x < 8; x++) // right to left
|
||||
{
|
||||
int color = loplane & 1 | hiplane & 2;
|
||||
*dest = pal[color];
|
||||
*dest = (int)(pal[color] | 0xFF000000);
|
||||
if (!hflip)
|
||||
dest--;
|
||||
else
|
||||
|
@ -316,9 +315,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
int* thispal = pal + 4 * (cgb ? flags & 7 : flags >> 4 & 1);
|
||||
if (cgb && flags.Bit(3))
|
||||
tile += 8192;
|
||||
|
||||
DrawTileHv(tile, dest, pitch, thispal, hflip, vflip);
|
||||
|
||||
if (tall)
|
||||
DrawTileHv((byte*)((int)tile ^ 16), dest + pitch * 8, pitch, thispal, hflip, vflip);
|
||||
DrawTileHv(tile + 16, dest + pitch * 8, pitch, thispal, hflip, vflip);
|
||||
dest += 8;
|
||||
}
|
||||
b.UnlockBits(lockdata);
|
||||
|
@ -341,7 +342,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
for (int py = 0; py < 4; py++)
|
||||
{
|
||||
*dest = *pal++;
|
||||
*dest = (int)(*pal++ | 0xFF000000);
|
||||
dest += pitch;
|
||||
}
|
||||
dest -= pitch * 4;
|
||||
|
@ -465,7 +466,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
DrawOam(bmpViewOAM.BMP, _oam, _vram, _sppal, lcdc.Bit(2), _cgb);
|
||||
bmpViewOAM.Refresh();
|
||||
}
|
||||
}
|
||||
// try to run the current mouseover, to refresh if the mouse is being held over a pane while the emulator runs
|
||||
// this doesn't really work well; the update rate seems to be throttled
|
||||
MouseEventArgs e = new MouseEventArgs(MouseButtons.None, 0, Cursor.Position.X, Cursor.Position.Y, 0);
|
||||
|
|
|
@ -92,6 +92,7 @@
|
|||
this.AddressLabel = new System.Windows.Forms.Label();
|
||||
this.AddressesLabel = new System.Windows.Forms.Label();
|
||||
this.Header = new System.Windows.Forms.Label();
|
||||
this.swapBytesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.HexMenuStrip.SuspendLayout();
|
||||
this.ViewerContextMenuStrip.SuspendLayout();
|
||||
this.MemoryViewerBox.SuspendLayout();
|
||||
|
@ -126,7 +127,7 @@
|
|||
this.toolStripSeparator1,
|
||||
this.ExitMenuItem});
|
||||
this.FileSubMenu.Name = "FileSubMenu";
|
||||
this.FileSubMenu.Size = new System.Drawing.Size(35, 20);
|
||||
this.FileSubMenu.Size = new System.Drawing.Size(37, 20);
|
||||
this.FileSubMenu.Text = "&File";
|
||||
this.FileSubMenu.DropDownOpened += new System.EventHandler(this.FileSubMenu_DropDownOpened);
|
||||
//
|
||||
|
@ -135,7 +136,7 @@
|
|||
this.SaveMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.SaveAs;
|
||||
this.SaveMenuItem.Name = "SaveMenuItem";
|
||||
this.SaveMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S)));
|
||||
this.SaveMenuItem.Size = new System.Drawing.Size(225, 22);
|
||||
this.SaveMenuItem.Size = new System.Drawing.Size(229, 22);
|
||||
this.SaveMenuItem.Text = "Save";
|
||||
this.SaveMenuItem.Click += new System.EventHandler(this.SaveMenuItem_Click);
|
||||
//
|
||||
|
@ -144,14 +145,14 @@
|
|||
this.SaveAsBinaryMenuItem.Name = "SaveAsBinaryMenuItem";
|
||||
this.SaveAsBinaryMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
|
||||
| System.Windows.Forms.Keys.S)));
|
||||
this.SaveAsBinaryMenuItem.Size = new System.Drawing.Size(225, 22);
|
||||
this.SaveAsBinaryMenuItem.Size = new System.Drawing.Size(229, 22);
|
||||
this.SaveAsBinaryMenuItem.Text = "Save as binary...";
|
||||
this.SaveAsBinaryMenuItem.Click += new System.EventHandler(this.SaveAsBinaryMenuItem_Click);
|
||||
//
|
||||
// SaveAsTextMenuItem
|
||||
//
|
||||
this.SaveAsTextMenuItem.Name = "SaveAsTextMenuItem";
|
||||
this.SaveAsTextMenuItem.Size = new System.Drawing.Size(225, 22);
|
||||
this.SaveAsTextMenuItem.Size = new System.Drawing.Size(229, 22);
|
||||
this.SaveAsTextMenuItem.Text = "Save as text...";
|
||||
this.SaveAsTextMenuItem.Click += new System.EventHandler(this.SaveAsTextMenuItem_Click);
|
||||
//
|
||||
|
@ -159,26 +160,26 @@
|
|||
//
|
||||
this.importAsBinaryToolStripMenuItem.Name = "importAsBinaryToolStripMenuItem";
|
||||
this.importAsBinaryToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.I)));
|
||||
this.importAsBinaryToolStripMenuItem.Size = new System.Drawing.Size(225, 22);
|
||||
this.importAsBinaryToolStripMenuItem.Size = new System.Drawing.Size(229, 22);
|
||||
this.importAsBinaryToolStripMenuItem.Text = "Import as binary...";
|
||||
this.importAsBinaryToolStripMenuItem.Click += new System.EventHandler(this.importAsBinaryToolStripMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator4
|
||||
//
|
||||
this.toolStripSeparator4.Name = "toolStripSeparator4";
|
||||
this.toolStripSeparator4.Size = new System.Drawing.Size(222, 6);
|
||||
this.toolStripSeparator4.Size = new System.Drawing.Size(226, 6);
|
||||
//
|
||||
// LoadTableFileMenuItem
|
||||
//
|
||||
this.LoadTableFileMenuItem.Name = "LoadTableFileMenuItem";
|
||||
this.LoadTableFileMenuItem.Size = new System.Drawing.Size(225, 22);
|
||||
this.LoadTableFileMenuItem.Size = new System.Drawing.Size(229, 22);
|
||||
this.LoadTableFileMenuItem.Text = "&Load .tbl file";
|
||||
this.LoadTableFileMenuItem.Click += new System.EventHandler(this.LoadTableFileMenuItem_Click);
|
||||
//
|
||||
// CloseTableFileMenuItem
|
||||
//
|
||||
this.CloseTableFileMenuItem.Name = "CloseTableFileMenuItem";
|
||||
this.CloseTableFileMenuItem.Size = new System.Drawing.Size(225, 22);
|
||||
this.CloseTableFileMenuItem.Size = new System.Drawing.Size(229, 22);
|
||||
this.CloseTableFileMenuItem.Text = "Close .tbl file";
|
||||
this.CloseTableFileMenuItem.Click += new System.EventHandler(this.CloseTableFileMenuItem_Click);
|
||||
//
|
||||
|
@ -187,26 +188,26 @@
|
|||
this.RecentTablesSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.noneToolStripMenuItem});
|
||||
this.RecentTablesSubMenu.Name = "RecentTablesSubMenu";
|
||||
this.RecentTablesSubMenu.Size = new System.Drawing.Size(225, 22);
|
||||
this.RecentTablesSubMenu.Size = new System.Drawing.Size(229, 22);
|
||||
this.RecentTablesSubMenu.Text = "Recent";
|
||||
this.RecentTablesSubMenu.DropDownOpened += new System.EventHandler(this.RecentTablesSubMenu_DropDownOpened);
|
||||
//
|
||||
// noneToolStripMenuItem
|
||||
//
|
||||
this.noneToolStripMenuItem.Name = "noneToolStripMenuItem";
|
||||
this.noneToolStripMenuItem.Size = new System.Drawing.Size(99, 22);
|
||||
this.noneToolStripMenuItem.Size = new System.Drawing.Size(103, 22);
|
||||
this.noneToolStripMenuItem.Text = "None";
|
||||
//
|
||||
// toolStripSeparator1
|
||||
//
|
||||
this.toolStripSeparator1.Name = "toolStripSeparator1";
|
||||
this.toolStripSeparator1.Size = new System.Drawing.Size(222, 6);
|
||||
this.toolStripSeparator1.Size = new System.Drawing.Size(226, 6);
|
||||
//
|
||||
// ExitMenuItem
|
||||
//
|
||||
this.ExitMenuItem.Name = "ExitMenuItem";
|
||||
this.ExitMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4)));
|
||||
this.ExitMenuItem.Size = new System.Drawing.Size(225, 22);
|
||||
this.ExitMenuItem.Size = new System.Drawing.Size(229, 22);
|
||||
this.ExitMenuItem.Text = "E&xit";
|
||||
this.ExitMenuItem.Click += new System.EventHandler(this.ExitMenuItem_Click);
|
||||
//
|
||||
|
@ -221,7 +222,7 @@
|
|||
this.FindNextMenuItem,
|
||||
this.FindPrevMenuItem});
|
||||
this.EditMenuItem.Name = "EditMenuItem";
|
||||
this.EditMenuItem.Size = new System.Drawing.Size(37, 20);
|
||||
this.EditMenuItem.Size = new System.Drawing.Size(39, 20);
|
||||
this.EditMenuItem.Text = "&Edit";
|
||||
this.EditMenuItem.DropDownOpened += new System.EventHandler(this.EditMenuItem_DropDownOpened);
|
||||
//
|
||||
|
@ -230,7 +231,7 @@
|
|||
this.CopyMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Duplicate;
|
||||
this.CopyMenuItem.Name = "CopyMenuItem";
|
||||
this.CopyMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C)));
|
||||
this.CopyMenuItem.Size = new System.Drawing.Size(144, 22);
|
||||
this.CopyMenuItem.Size = new System.Drawing.Size(147, 22);
|
||||
this.CopyMenuItem.Text = "&Copy";
|
||||
this.CopyMenuItem.Click += new System.EventHandler(this.CopyMenuItem_Click);
|
||||
//
|
||||
|
@ -238,7 +239,7 @@
|
|||
//
|
||||
this.ExportMenuItem.Name = "ExportMenuItem";
|
||||
this.ExportMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.E)));
|
||||
this.ExportMenuItem.Size = new System.Drawing.Size(144, 22);
|
||||
this.ExportMenuItem.Size = new System.Drawing.Size(147, 22);
|
||||
this.ExportMenuItem.Text = "&Export";
|
||||
this.ExportMenuItem.Click += new System.EventHandler(this.ExportMenuItem_Click);
|
||||
//
|
||||
|
@ -247,20 +248,20 @@
|
|||
this.PasteMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Paste;
|
||||
this.PasteMenuItem.Name = "PasteMenuItem";
|
||||
this.PasteMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.V)));
|
||||
this.PasteMenuItem.Size = new System.Drawing.Size(144, 22);
|
||||
this.PasteMenuItem.Size = new System.Drawing.Size(147, 22);
|
||||
this.PasteMenuItem.Text = "&Paste";
|
||||
this.PasteMenuItem.Click += new System.EventHandler(this.PasteMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator6
|
||||
//
|
||||
this.toolStripSeparator6.Name = "toolStripSeparator6";
|
||||
this.toolStripSeparator6.Size = new System.Drawing.Size(141, 6);
|
||||
this.toolStripSeparator6.Size = new System.Drawing.Size(144, 6);
|
||||
//
|
||||
// FindMenuItem
|
||||
//
|
||||
this.FindMenuItem.Name = "FindMenuItem";
|
||||
this.FindMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F)));
|
||||
this.FindMenuItem.Size = new System.Drawing.Size(144, 22);
|
||||
this.FindMenuItem.Size = new System.Drawing.Size(147, 22);
|
||||
this.FindMenuItem.Text = "&Find...";
|
||||
this.FindMenuItem.Click += new System.EventHandler(this.FindMenuItem_Click);
|
||||
//
|
||||
|
@ -268,7 +269,7 @@
|
|||
//
|
||||
this.FindNextMenuItem.Name = "FindNextMenuItem";
|
||||
this.FindNextMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F3;
|
||||
this.FindNextMenuItem.Size = new System.Drawing.Size(144, 22);
|
||||
this.FindNextMenuItem.Size = new System.Drawing.Size(147, 22);
|
||||
this.FindNextMenuItem.Text = "Find Next";
|
||||
this.FindNextMenuItem.Click += new System.EventHandler(this.FindNextMenuItem_Click);
|
||||
//
|
||||
|
@ -276,7 +277,7 @@
|
|||
//
|
||||
this.FindPrevMenuItem.Name = "FindPrevMenuItem";
|
||||
this.FindPrevMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F2;
|
||||
this.FindPrevMenuItem.Size = new System.Drawing.Size(144, 22);
|
||||
this.FindPrevMenuItem.Size = new System.Drawing.Size(147, 22);
|
||||
this.FindPrevMenuItem.Text = "Find Prev";
|
||||
this.FindPrevMenuItem.Click += new System.EventHandler(this.FindPrevMenuItem_Click);
|
||||
//
|
||||
|
@ -285,6 +286,7 @@
|
|||
this.OptionsSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.MemoryDomainsMenuItem,
|
||||
this.DataSizeSubMenu,
|
||||
this.swapBytesToolStripMenuItem,
|
||||
this.BigEndianMenuItem,
|
||||
this.toolStripSeparator2,
|
||||
this.GoToAddressMenuItem,
|
||||
|
@ -293,7 +295,7 @@
|
|||
this.UnfreezeAllMenuItem,
|
||||
this.PokeAddressMenuItem});
|
||||
this.OptionsSubMenu.Name = "OptionsSubMenu";
|
||||
this.OptionsSubMenu.Size = new System.Drawing.Size(56, 20);
|
||||
this.OptionsSubMenu.Size = new System.Drawing.Size(61, 20);
|
||||
this.OptionsSubMenu.Text = "&Options";
|
||||
this.OptionsSubMenu.DropDownOpened += new System.EventHandler(this.OptionsSubMenu_DropDownOpened);
|
||||
//
|
||||
|
@ -302,7 +304,7 @@
|
|||
this.MemoryDomainsMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.toolStripSeparator3});
|
||||
this.MemoryDomainsMenuItem.Name = "MemoryDomainsMenuItem";
|
||||
this.MemoryDomainsMenuItem.Size = new System.Drawing.Size(207, 22);
|
||||
this.MemoryDomainsMenuItem.Size = new System.Drawing.Size(221, 22);
|
||||
this.MemoryDomainsMenuItem.Text = "&Memory Domains";
|
||||
this.MemoryDomainsMenuItem.DropDownOpened += new System.EventHandler(this.MemoryDomainsMenuItem_DropDownOpened);
|
||||
//
|
||||
|
@ -318,47 +320,47 @@
|
|||
this.DataSizeWordMenuItem,
|
||||
this.DataSizeDWordMenuItem});
|
||||
this.DataSizeSubMenu.Name = "DataSizeSubMenu";
|
||||
this.DataSizeSubMenu.Size = new System.Drawing.Size(207, 22);
|
||||
this.DataSizeSubMenu.Size = new System.Drawing.Size(221, 22);
|
||||
this.DataSizeSubMenu.Text = "Data Size";
|
||||
//
|
||||
// DataSizeByteMenuItem
|
||||
//
|
||||
this.DataSizeByteMenuItem.Name = "DataSizeByteMenuItem";
|
||||
this.DataSizeByteMenuItem.Size = new System.Drawing.Size(105, 22);
|
||||
this.DataSizeByteMenuItem.Size = new System.Drawing.Size(106, 22);
|
||||
this.DataSizeByteMenuItem.Text = "1 Byte";
|
||||
this.DataSizeByteMenuItem.Click += new System.EventHandler(this.DataSizeByteMenuItem_Click);
|
||||
//
|
||||
// DataSizeWordMenuItem
|
||||
//
|
||||
this.DataSizeWordMenuItem.Name = "DataSizeWordMenuItem";
|
||||
this.DataSizeWordMenuItem.Size = new System.Drawing.Size(105, 22);
|
||||
this.DataSizeWordMenuItem.Size = new System.Drawing.Size(106, 22);
|
||||
this.DataSizeWordMenuItem.Text = "2 Byte";
|
||||
this.DataSizeWordMenuItem.Click += new System.EventHandler(this.DataSizeWordMenuItem_Click);
|
||||
//
|
||||
// DataSizeDWordMenuItem
|
||||
//
|
||||
this.DataSizeDWordMenuItem.Name = "DataSizeDWordMenuItem";
|
||||
this.DataSizeDWordMenuItem.Size = new System.Drawing.Size(105, 22);
|
||||
this.DataSizeDWordMenuItem.Size = new System.Drawing.Size(106, 22);
|
||||
this.DataSizeDWordMenuItem.Text = "4 Byte";
|
||||
this.DataSizeDWordMenuItem.Click += new System.EventHandler(this.DataSizeDWordMenuItem_Click);
|
||||
//
|
||||
// BigEndianMenuItem
|
||||
//
|
||||
this.BigEndianMenuItem.Name = "BigEndianMenuItem";
|
||||
this.BigEndianMenuItem.Size = new System.Drawing.Size(207, 22);
|
||||
this.BigEndianMenuItem.Size = new System.Drawing.Size(221, 22);
|
||||
this.BigEndianMenuItem.Text = "Big Endian";
|
||||
this.BigEndianMenuItem.Click += new System.EventHandler(this.BigEndianMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator2
|
||||
//
|
||||
this.toolStripSeparator2.Name = "toolStripSeparator2";
|
||||
this.toolStripSeparator2.Size = new System.Drawing.Size(204, 6);
|
||||
this.toolStripSeparator2.Size = new System.Drawing.Size(218, 6);
|
||||
//
|
||||
// GoToAddressMenuItem
|
||||
//
|
||||
this.GoToAddressMenuItem.Name = "GoToAddressMenuItem";
|
||||
this.GoToAddressMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.G)));
|
||||
this.GoToAddressMenuItem.Size = new System.Drawing.Size(207, 22);
|
||||
this.GoToAddressMenuItem.Size = new System.Drawing.Size(221, 22);
|
||||
this.GoToAddressMenuItem.Text = "&Go to Address...";
|
||||
this.GoToAddressMenuItem.Click += new System.EventHandler(this.GoToAddressMenuItem_Click);
|
||||
//
|
||||
|
@ -367,7 +369,7 @@
|
|||
this.AddToRamWatchMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.FindHS;
|
||||
this.AddToRamWatchMenuItem.Name = "AddToRamWatchMenuItem";
|
||||
this.AddToRamWatchMenuItem.ShortcutKeyDisplayString = "Ctrl+W";
|
||||
this.AddToRamWatchMenuItem.Size = new System.Drawing.Size(207, 22);
|
||||
this.AddToRamWatchMenuItem.Size = new System.Drawing.Size(221, 22);
|
||||
this.AddToRamWatchMenuItem.Text = "Add to RAM Watch";
|
||||
this.AddToRamWatchMenuItem.Click += new System.EventHandler(this.AddToRamWatchMenuItem_Click);
|
||||
//
|
||||
|
@ -376,7 +378,7 @@
|
|||
this.FreezeAddressMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Freeze;
|
||||
this.FreezeAddressMenuItem.Name = "FreezeAddressMenuItem";
|
||||
this.FreezeAddressMenuItem.ShortcutKeyDisplayString = "Space";
|
||||
this.FreezeAddressMenuItem.Size = new System.Drawing.Size(207, 22);
|
||||
this.FreezeAddressMenuItem.Size = new System.Drawing.Size(221, 22);
|
||||
this.FreezeAddressMenuItem.Text = "&Freeze Address";
|
||||
this.FreezeAddressMenuItem.Click += new System.EventHandler(this.FreezeAddressMenuItem_Click);
|
||||
//
|
||||
|
@ -385,7 +387,7 @@
|
|||
this.UnfreezeAllMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Unfreeze;
|
||||
this.UnfreezeAllMenuItem.Name = "UnfreezeAllMenuItem";
|
||||
this.UnfreezeAllMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Shift | System.Windows.Forms.Keys.Delete)));
|
||||
this.UnfreezeAllMenuItem.Size = new System.Drawing.Size(207, 22);
|
||||
this.UnfreezeAllMenuItem.Size = new System.Drawing.Size(221, 22);
|
||||
this.UnfreezeAllMenuItem.Text = "Unfreeze All";
|
||||
this.UnfreezeAllMenuItem.Click += new System.EventHandler(this.UnfreezeAllMenuItem_Click);
|
||||
//
|
||||
|
@ -394,7 +396,7 @@
|
|||
this.PokeAddressMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.poke;
|
||||
this.PokeAddressMenuItem.Name = "PokeAddressMenuItem";
|
||||
this.PokeAddressMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.P)));
|
||||
this.PokeAddressMenuItem.Size = new System.Drawing.Size(207, 22);
|
||||
this.PokeAddressMenuItem.Size = new System.Drawing.Size(221, 22);
|
||||
this.PokeAddressMenuItem.Text = "&Poke Address";
|
||||
this.PokeAddressMenuItem.Click += new System.EventHandler(this.PokeAddressMenuItem_Click);
|
||||
//
|
||||
|
@ -403,7 +405,7 @@
|
|||
this.SettingsSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.CustomColorsSubMenu});
|
||||
this.SettingsSubMenu.Name = "SettingsSubMenu";
|
||||
this.SettingsSubMenu.Size = new System.Drawing.Size(58, 20);
|
||||
this.SettingsSubMenu.Size = new System.Drawing.Size(61, 20);
|
||||
this.SettingsSubMenu.Text = "&Settings";
|
||||
//
|
||||
// CustomColorsSubMenu
|
||||
|
@ -413,25 +415,25 @@
|
|||
this.toolStripSeparator8,
|
||||
this.ResetColorsToDefaultMenuItem});
|
||||
this.CustomColorsSubMenu.Name = "CustomColorsSubMenu";
|
||||
this.CustomColorsSubMenu.Size = new System.Drawing.Size(143, 22);
|
||||
this.CustomColorsSubMenu.Size = new System.Drawing.Size(153, 22);
|
||||
this.CustomColorsSubMenu.Text = "Custom Colors";
|
||||
//
|
||||
// SetColorsMenuItem
|
||||
//
|
||||
this.SetColorsMenuItem.Name = "SetColorsMenuItem";
|
||||
this.SetColorsMenuItem.Size = new System.Drawing.Size(153, 22);
|
||||
this.SetColorsMenuItem.Size = new System.Drawing.Size(157, 22);
|
||||
this.SetColorsMenuItem.Text = "Set Colors";
|
||||
this.SetColorsMenuItem.Click += new System.EventHandler(this.SetColorsMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator8
|
||||
//
|
||||
this.toolStripSeparator8.Name = "toolStripSeparator8";
|
||||
this.toolStripSeparator8.Size = new System.Drawing.Size(150, 6);
|
||||
this.toolStripSeparator8.Size = new System.Drawing.Size(154, 6);
|
||||
//
|
||||
// ResetColorsToDefaultMenuItem
|
||||
//
|
||||
this.ResetColorsToDefaultMenuItem.Name = "ResetColorsToDefaultMenuItem";
|
||||
this.ResetColorsToDefaultMenuItem.Size = new System.Drawing.Size(153, 22);
|
||||
this.ResetColorsToDefaultMenuItem.Size = new System.Drawing.Size(157, 22);
|
||||
this.ResetColorsToDefaultMenuItem.Text = "Reset to Default";
|
||||
this.ResetColorsToDefaultMenuItem.Click += new System.EventHandler(this.ResetColorsToDefaultMenuItem_Click);
|
||||
//
|
||||
|
@ -464,7 +466,7 @@
|
|||
this.toolStripMenuItem1,
|
||||
this.viewN64MatrixToolStripMenuItem});
|
||||
this.ViewerContextMenuStrip.Name = "ViewerContextMenuStrip";
|
||||
this.ViewerContextMenuStrip.Size = new System.Drawing.Size(208, 264);
|
||||
this.ViewerContextMenuStrip.Size = new System.Drawing.Size(222, 264);
|
||||
this.ViewerContextMenuStrip.Opening += new System.ComponentModel.CancelEventHandler(this.ViewerContextMenuStrip_Opening);
|
||||
//
|
||||
// CopyContextItem
|
||||
|
@ -472,7 +474,7 @@
|
|||
this.CopyContextItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Duplicate;
|
||||
this.CopyContextItem.Name = "CopyContextItem";
|
||||
this.CopyContextItem.ShortcutKeyDisplayString = "Ctrl+C";
|
||||
this.CopyContextItem.Size = new System.Drawing.Size(207, 22);
|
||||
this.CopyContextItem.Size = new System.Drawing.Size(221, 22);
|
||||
this.CopyContextItem.Text = "&Copy";
|
||||
this.CopyContextItem.Click += new System.EventHandler(this.CopyMenuItem_Click);
|
||||
//
|
||||
|
@ -480,7 +482,7 @@
|
|||
//
|
||||
this.ExportContextItem.Name = "ExportContextItem";
|
||||
this.ExportContextItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.E)));
|
||||
this.ExportContextItem.Size = new System.Drawing.Size(207, 22);
|
||||
this.ExportContextItem.Size = new System.Drawing.Size(221, 22);
|
||||
this.ExportContextItem.Text = "&Export";
|
||||
//
|
||||
// PasteContextItem
|
||||
|
@ -488,7 +490,7 @@
|
|||
this.PasteContextItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Paste;
|
||||
this.PasteContextItem.Name = "PasteContextItem";
|
||||
this.PasteContextItem.ShortcutKeyDisplayString = "Ctrl+V";
|
||||
this.PasteContextItem.Size = new System.Drawing.Size(207, 22);
|
||||
this.PasteContextItem.Size = new System.Drawing.Size(221, 22);
|
||||
this.PasteContextItem.Text = "&Paste";
|
||||
this.PasteContextItem.Click += new System.EventHandler(this.PasteMenuItem_Click);
|
||||
//
|
||||
|
@ -497,7 +499,7 @@
|
|||
this.FreezeContextItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Freeze;
|
||||
this.FreezeContextItem.Name = "FreezeContextItem";
|
||||
this.FreezeContextItem.ShortcutKeyDisplayString = "Space";
|
||||
this.FreezeContextItem.Size = new System.Drawing.Size(207, 22);
|
||||
this.FreezeContextItem.Size = new System.Drawing.Size(221, 22);
|
||||
this.FreezeContextItem.Text = "&Freeze";
|
||||
this.FreezeContextItem.Click += new System.EventHandler(this.FreezeAddressMenuItem_Click);
|
||||
//
|
||||
|
@ -506,7 +508,7 @@
|
|||
this.AddToRamWatchContextItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.FindHS;
|
||||
this.AddToRamWatchContextItem.Name = "AddToRamWatchContextItem";
|
||||
this.AddToRamWatchContextItem.ShortcutKeyDisplayString = "Ctrl+W";
|
||||
this.AddToRamWatchContextItem.Size = new System.Drawing.Size(207, 22);
|
||||
this.AddToRamWatchContextItem.Size = new System.Drawing.Size(221, 22);
|
||||
this.AddToRamWatchContextItem.Text = "&Add to RAM Watch";
|
||||
this.AddToRamWatchContextItem.Click += new System.EventHandler(this.AddToRamWatchMenuItem_Click);
|
||||
//
|
||||
|
@ -515,7 +517,7 @@
|
|||
this.UnfreezeAllContextItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Unfreeze;
|
||||
this.UnfreezeAllContextItem.Name = "UnfreezeAllContextItem";
|
||||
this.UnfreezeAllContextItem.ShortcutKeyDisplayString = "Shift+Del";
|
||||
this.UnfreezeAllContextItem.Size = new System.Drawing.Size(207, 22);
|
||||
this.UnfreezeAllContextItem.Size = new System.Drawing.Size(221, 22);
|
||||
this.UnfreezeAllContextItem.Text = "&Unfreeze All";
|
||||
this.UnfreezeAllContextItem.Click += new System.EventHandler(this.UnfreezeAllMenuItem_Click);
|
||||
//
|
||||
|
@ -524,20 +526,20 @@
|
|||
this.PokeContextItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.poke;
|
||||
this.PokeContextItem.Name = "PokeContextItem";
|
||||
this.PokeContextItem.ShortcutKeyDisplayString = "Ctrl+P";
|
||||
this.PokeContextItem.Size = new System.Drawing.Size(207, 22);
|
||||
this.PokeContextItem.Size = new System.Drawing.Size(221, 22);
|
||||
this.PokeContextItem.Text = "&Poke Address";
|
||||
this.PokeContextItem.Click += new System.EventHandler(this.PokeAddressMenuItem_Click);
|
||||
//
|
||||
// ContextSeparator1
|
||||
//
|
||||
this.ContextSeparator1.Name = "ContextSeparator1";
|
||||
this.ContextSeparator1.Size = new System.Drawing.Size(204, 6);
|
||||
this.ContextSeparator1.Size = new System.Drawing.Size(218, 6);
|
||||
//
|
||||
// IncrementContextItem
|
||||
//
|
||||
this.IncrementContextItem.Name = "IncrementContextItem";
|
||||
this.IncrementContextItem.ShortcutKeyDisplayString = "+";
|
||||
this.IncrementContextItem.Size = new System.Drawing.Size(207, 22);
|
||||
this.IncrementContextItem.Size = new System.Drawing.Size(221, 22);
|
||||
this.IncrementContextItem.Text = "&Increment";
|
||||
this.IncrementContextItem.Click += new System.EventHandler(this.IncrementContextItem_Click);
|
||||
//
|
||||
|
@ -545,32 +547,32 @@
|
|||
//
|
||||
this.DecrementContextItem.Name = "DecrementContextItem";
|
||||
this.DecrementContextItem.ShortcutKeyDisplayString = "-";
|
||||
this.DecrementContextItem.Size = new System.Drawing.Size(207, 22);
|
||||
this.DecrementContextItem.Size = new System.Drawing.Size(221, 22);
|
||||
this.DecrementContextItem.Text = "&Decrement";
|
||||
this.DecrementContextItem.Click += new System.EventHandler(this.DecrementContextItem_Click);
|
||||
//
|
||||
// ContextSeparator2
|
||||
//
|
||||
this.ContextSeparator2.Name = "ContextSeparator2";
|
||||
this.ContextSeparator2.Size = new System.Drawing.Size(204, 6);
|
||||
this.ContextSeparator2.Size = new System.Drawing.Size(218, 6);
|
||||
//
|
||||
// GoToContextItem
|
||||
//
|
||||
this.GoToContextItem.Name = "GoToContextItem";
|
||||
this.GoToContextItem.ShortcutKeyDisplayString = "Ctrl+G";
|
||||
this.GoToContextItem.Size = new System.Drawing.Size(207, 22);
|
||||
this.GoToContextItem.Size = new System.Drawing.Size(221, 22);
|
||||
this.GoToContextItem.Text = "&Go to Address...";
|
||||
this.GoToContextItem.Click += new System.EventHandler(this.GoToAddressMenuItem_Click);
|
||||
//
|
||||
// toolStripMenuItem1
|
||||
//
|
||||
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
|
||||
this.toolStripMenuItem1.Size = new System.Drawing.Size(204, 6);
|
||||
this.toolStripMenuItem1.Size = new System.Drawing.Size(218, 6);
|
||||
//
|
||||
// viewN64MatrixToolStripMenuItem
|
||||
//
|
||||
this.viewN64MatrixToolStripMenuItem.Name = "viewN64MatrixToolStripMenuItem";
|
||||
this.viewN64MatrixToolStripMenuItem.Size = new System.Drawing.Size(207, 22);
|
||||
this.viewN64MatrixToolStripMenuItem.Size = new System.Drawing.Size(221, 22);
|
||||
this.viewN64MatrixToolStripMenuItem.Text = "View N64 Matrix";
|
||||
this.viewN64MatrixToolStripMenuItem.Click += new System.EventHandler(this.viewN64MatrixToolStripMenuItem_Click);
|
||||
//
|
||||
|
@ -638,6 +640,14 @@
|
|||
this.Header.TabIndex = 2;
|
||||
this.Header.Text = "label1";
|
||||
//
|
||||
// swapBytesToolStripMenuItem
|
||||
//
|
||||
this.swapBytesToolStripMenuItem.CheckOnClick = true;
|
||||
this.swapBytesToolStripMenuItem.Name = "swapBytesToolStripMenuItem";
|
||||
this.swapBytesToolStripMenuItem.Size = new System.Drawing.Size(221, 22);
|
||||
this.swapBytesToolStripMenuItem.Text = "Swap Bytes";
|
||||
this.swapBytesToolStripMenuItem.Click += new System.EventHandler(this.SwapBytesMenuItem_Click);
|
||||
//
|
||||
// HexEditor
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
@ -732,5 +742,6 @@
|
|||
private System.Windows.Forms.ToolStripMenuItem ExportContextItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem ExportMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem importAsBinaryToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem swapBytesToolStripMenuItem;
|
||||
}
|
||||
}
|
|
@ -79,6 +79,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
private MemoryDomain _romDomain;
|
||||
private HexFind _hexFind = new HexFind();
|
||||
|
||||
[ConfigPersist]
|
||||
private bool SwapBytes { get; set; }
|
||||
|
||||
[ConfigPersist]
|
||||
private bool BigEndian { get; set; }
|
||||
|
||||
|
@ -179,7 +182,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
_domain = MemoryDomains.MainMemory;
|
||||
}
|
||||
|
||||
SwapBytes = false;
|
||||
BigEndian = _domain.EndianType == MemoryDomain.Endian.Big;
|
||||
|
||||
_maxRow = _domain.Size / 2;
|
||||
|
||||
// Don't reset scroll bar if restarting the same rom
|
||||
|
@ -528,11 +533,19 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
int t_val = 0;
|
||||
int t_next = 0;
|
||||
|
||||
bool is_cht;
|
||||
for (int k = 0; k < DataSize; k++)
|
||||
{
|
||||
t_next = MakeValue(1, _addr + j + k);
|
||||
t_val += (t_next << ((DataSize - k - 1) * 8));
|
||||
t_next = MakeValue(1, _addr + j + k, out is_cht);
|
||||
|
||||
if (SwapBytes)
|
||||
{
|
||||
t_val += (t_next << (k * 8));
|
||||
}
|
||||
else
|
||||
{
|
||||
t_val += (t_next << ((DataSize - k - 1) * 8));
|
||||
}
|
||||
}
|
||||
|
||||
rowStr.AppendFormat(_digitFormatString, t_val);
|
||||
|
@ -574,28 +587,31 @@ namespace BizHawk.Client.EmuHawk
|
|||
: _domain.PeekByte(address);
|
||||
}
|
||||
|
||||
private int MakeValue(int dataSize, long address)
|
||||
private int MakeValue(int dataSize, long address, out bool is_cheat)
|
||||
{
|
||||
if (Global.CheatList.IsActive(_domain, address))
|
||||
{
|
||||
is_cheat = true;
|
||||
return Global.CheatList.GetCheatValue(_domain, address, (WatchSize)dataSize ).Value;
|
||||
}
|
||||
|
||||
is_cheat = false;
|
||||
switch (dataSize)
|
||||
{
|
||||
default:
|
||||
case 1:
|
||||
return _domain.PeekByte(address);
|
||||
case 2:
|
||||
return _domain.PeekUshort(address, BigEndian);
|
||||
return _domain.PeekUshort(address, SwapBytes);
|
||||
case 4:
|
||||
return (int)_domain.PeekUint(address, BigEndian);
|
||||
return (int)_domain.PeekUint(address, SwapBytes);
|
||||
}
|
||||
}
|
||||
|
||||
private int MakeValue(long address)
|
||||
{
|
||||
return MakeValue(DataSize, address);
|
||||
bool temp;
|
||||
return MakeValue(DataSize, address, out temp);
|
||||
}
|
||||
|
||||
private void SetMemoryDomain(string name)
|
||||
|
@ -609,6 +625,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
_domain = MemoryDomains[name];
|
||||
}
|
||||
|
||||
SwapBytes = false;
|
||||
BigEndian = _domain.EndianType == MemoryDomain.Endian.Big;
|
||||
_maxRow = _domain.Size / 2;
|
||||
SetUpScrollBar();
|
||||
|
@ -1453,8 +1470,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
long start = addresses[i];
|
||||
long end = addresses[i] + DataSize -1 ;
|
||||
bool temp;
|
||||
for(long a = start;a<=end;a++)
|
||||
sb.AppendFormat("{0:X2}", MakeValue(1,a));
|
||||
sb.AppendFormat("{0:X2}", MakeValue(1,a, out temp));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1607,7 +1625,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void BigEndianMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
BigEndian ^= true;
|
||||
//BigEndian ^= true;
|
||||
//UpdateValues();
|
||||
}
|
||||
|
||||
private void SwapBytesMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
SwapBytes ^= true;
|
||||
UpdateValues();
|
||||
}
|
||||
|
||||
|
|
|
@ -36,18 +36,21 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public override string Name => "client";
|
||||
|
||||
[LuaMethodExample("client.exit( );")]
|
||||
[LuaMethod("exit", "Closes the emulator")]
|
||||
public void CloseEmulator()
|
||||
{
|
||||
GlobalWin.MainForm.CloseEmulator();
|
||||
}
|
||||
|
||||
[LuaMethodExample("client.exitCode( 0 );")]
|
||||
[LuaMethod("exitCode", "Closes the emulator and returns the provided code")]
|
||||
public void CloseEmulatorWithCode(int exitCode)
|
||||
{
|
||||
GlobalWin.MainForm.CloseEmulator(exitCode);
|
||||
}
|
||||
|
||||
[LuaMethodExample("local inclibor = client.borderheight( );")]
|
||||
[LuaMethod("borderheight", "Gets the current height in pixels of the letter/pillarbox area (top side only) around the emu display surface, excluding the gameExtraPadding you've set. This function (the whole lot of them) should be renamed or refactored since the padding areas have got more complex.")]
|
||||
public static int BorderHeight()
|
||||
{
|
||||
|
@ -55,6 +58,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
return GlobalWin.DisplayManager.TransformPoint(point).Y;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local inclibor = client.borderwidth( );")]
|
||||
[LuaMethod("borderwidth", "Gets the current width in pixels of the letter/pillarbox area (left side only) around the emu display surface, excluding the gameExtraPadding you've set. This function (the whole lot of them) should be renamed or refactored since the padding areas have got more complex.")]
|
||||
public static int BorderWidth()
|
||||
{
|
||||
|
@ -62,36 +66,42 @@ namespace BizHawk.Client.EmuHawk
|
|||
return GlobalWin.DisplayManager.TransformPoint(point).X;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local inclibuf = client.bufferheight( );")]
|
||||
[LuaMethod("bufferheight", "Gets the visible height of the emu display surface (the core video output). This excludes the gameExtraPadding you've set.")]
|
||||
public int BufferHeight()
|
||||
{
|
||||
return VideoProvider.BufferHeight;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local inclibuf = client.bufferwidth( );")]
|
||||
[LuaMethod("bufferwidth", "Gets the visible width of the emu display surface (the core video output). This excludes the gameExtraPadding you've set.")]
|
||||
public int BufferWidth()
|
||||
{
|
||||
return VideoProvider.BufferWidth;
|
||||
}
|
||||
|
||||
[LuaMethodExample("client.clearautohold( );")]
|
||||
[LuaMethod("clearautohold", "Clears all autohold keys")]
|
||||
public void ClearAutohold()
|
||||
{
|
||||
GlobalWin.MainForm.ClearHolds();
|
||||
}
|
||||
|
||||
[LuaMethodExample("client.closerom( );")]
|
||||
[LuaMethod("closerom", "Closes the loaded Rom")]
|
||||
public static void CloseRom()
|
||||
{
|
||||
GlobalWin.MainForm.CloseRom();
|
||||
}
|
||||
|
||||
[LuaMethodExample("client.enablerewind( true );")]
|
||||
[LuaMethod("enablerewind", "Sets whether or not the rewind feature is enabled")]
|
||||
public void EnableRewind(bool enabled)
|
||||
{
|
||||
GlobalWin.MainForm.EnableRewind(enabled);
|
||||
}
|
||||
|
||||
[LuaMethodExample("client.frameskip( 8 );")]
|
||||
[LuaMethod("frameskip", "Sets the frame skip value of the client UI")]
|
||||
public void FrameSkip(int numFrames)
|
||||
{
|
||||
|
@ -106,18 +116,21 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("local incliget = client.gettargetscanlineintensity( );")]
|
||||
[LuaMethod("gettargetscanlineintensity", "Gets the current scanline intensity setting, used for the scanline display filter")]
|
||||
public static int GetTargetScanlineIntensity()
|
||||
{
|
||||
return Global.Config.TargetScanlineFilterIntensity;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local incliget = client.getwindowsize( );")]
|
||||
[LuaMethod("getwindowsize", "Gets the main window's size Possible values are 1, 2, 3, 4, 5, and 10")]
|
||||
public int GetWindowSize()
|
||||
{
|
||||
return Global.Config.TargetZoomFactors[Emulator.SystemId];
|
||||
}
|
||||
|
||||
[LuaMethodExample("client.SetGameExtraPadding( 5, 10, 15, 20 );")]
|
||||
[LuaMethod("SetGameExtraPadding", "Sets the extra padding added to the 'emu' surface so that you can draw HUD elements in predictable placements")]
|
||||
public static void SetGameExtraPadding(int left, int top, int right, int bottom)
|
||||
{
|
||||
|
@ -125,18 +138,21 @@ namespace BizHawk.Client.EmuHawk
|
|||
GlobalWin.MainForm.FrameBufferResized();
|
||||
}
|
||||
|
||||
[LuaMethodExample("client.SetSoundOn( true );")]
|
||||
[LuaMethod("SetSoundOn", "Sets the state of the Sound On toggle")]
|
||||
public static void SetSoundOn(bool enable)
|
||||
{
|
||||
Global.Config.SoundEnabled = enable;
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( client.GetSoundOn( ) ) then\r\n\tconsole.log( \"Gets the state of the Sound On toggle\" );\r\nend;")]
|
||||
[LuaMethod("GetSoundOn", "Gets the state of the Sound On toggle")]
|
||||
public static bool GetSoundOn()
|
||||
{
|
||||
return Global.Config.SoundEnabled;
|
||||
}
|
||||
|
||||
[LuaMethodExample("client.SetClientExtraPadding( 5, 10, 15, 20 );")]
|
||||
[LuaMethod("SetClientExtraPadding", "Sets the extra padding added to the 'native' surface so that you can draw HUD elements in predictable placements")]
|
||||
public static void SetClientExtraPadding(int left, int top, int right, int bottom)
|
||||
{
|
||||
|
@ -144,72 +160,99 @@ namespace BizHawk.Client.EmuHawk
|
|||
GlobalWin.MainForm.FrameBufferResized();
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( client.ispaused( ) ) then\r\n\tconsole.log( \"Returns true if emulator is paused, otherwise, false\" );\r\nend;")]
|
||||
[LuaMethod("ispaused", "Returns true if emulator is paused, otherwise, false")]
|
||||
public static bool IsPaused()
|
||||
{
|
||||
return GlobalWin.MainForm.EmulatorPaused;
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( client.client.isturbo( ) ) then\r\n\tconsole.log( \"Returns true if emulator is in turbo mode, otherwise, false\" );\r\nend;")]
|
||||
[LuaMethod("isturbo", "Returns true if emulator is in turbo mode, otherwise, false")]
|
||||
public static bool IsTurbo()
|
||||
{
|
||||
return GlobalWin.MainForm.IsTurboing;
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( client.isseeking( ) ) then\r\n\tconsole.log( \"Returns true if emulator is seeking, otherwise, false\" );\r\nend;")]
|
||||
[LuaMethod("isseeking", "Returns true if emulator is seeking, otherwise, false")]
|
||||
public static bool IsSeeking()
|
||||
{
|
||||
return GlobalWin.MainForm.IsSeeking;
|
||||
}
|
||||
|
||||
[LuaMethodExample("client.opencheats( );")]
|
||||
[LuaMethod("opencheats", "opens the Cheats dialog")]
|
||||
public static void OpenCheats()
|
||||
{
|
||||
GlobalWin.Tools.Load<Cheats>();
|
||||
}
|
||||
|
||||
[LuaMethodExample("client.openhexeditor( );")]
|
||||
[LuaMethod("openhexeditor", "opens the Hex Editor dialog")]
|
||||
public static void OpenHexEditor()
|
||||
{
|
||||
GlobalWin.Tools.Load<HexEditor>();
|
||||
}
|
||||
|
||||
[LuaMethodExample("client.openramwatch( );")]
|
||||
[LuaMethod("openramwatch", "opens the RAM Watch dialog")]
|
||||
public static void OpenRamWatch()
|
||||
{
|
||||
GlobalWin.Tools.LoadRamWatch(loadDialog: true);
|
||||
}
|
||||
|
||||
[LuaMethodExample("client.openramsearch( );")]
|
||||
[LuaMethod("openramsearch", "opens the RAM Search dialog")]
|
||||
public static void OpenRamSearch()
|
||||
{
|
||||
GlobalWin.Tools.Load<RamSearch>();
|
||||
}
|
||||
|
||||
[LuaMethodExample("client.openrom( \"C:\\\" );")]
|
||||
[LuaMethod("openrom", "opens the Open ROM dialog")]
|
||||
public static void OpenRom(string path)
|
||||
{
|
||||
GlobalWin.MainForm.LoadRom(path, new MainForm.LoadRomArgs { OpenAdvanced = new OpenAdvanced_OpenRom() });
|
||||
var ioa = OpenAdvancedSerializer.ParseWithLegacy(path);
|
||||
GlobalWin.MainForm.LoadRom(path, new MainForm.LoadRomArgs { OpenAdvanced = ioa });
|
||||
}
|
||||
|
||||
[LuaMethodExample("client.opentasstudio( );")]
|
||||
[LuaMethod("opentasstudio", "opens the TAStudio dialog")]
|
||||
public static void OpenTasStudio()
|
||||
{
|
||||
GlobalWin.Tools.Load<TAStudio>();
|
||||
}
|
||||
|
||||
[LuaMethodExample("client.opentoolbox( );")]
|
||||
[LuaMethod("opentoolbox", "opens the Toolbox Dialog")]
|
||||
public static void OpenToolBox()
|
||||
{
|
||||
GlobalWin.Tools.Load<ToolBox>();
|
||||
}
|
||||
|
||||
[LuaMethodExample("client.opentracelogger( );")]
|
||||
[LuaMethod("opentracelogger", "opens the tracelogger if it is available for the given core")]
|
||||
public static void OpenTraceLogger()
|
||||
{
|
||||
GlobalWin.Tools.Load<TraceLogger>();
|
||||
}
|
||||
|
||||
[LuaMethodExample("client.pause( );")]
|
||||
[LuaMethod("pause", "Pauses the emulator")]
|
||||
public static void Pause()
|
||||
{
|
||||
GlobalWin.MainForm.PauseEmulator();
|
||||
}
|
||||
|
||||
[LuaMethodExample("client.pause_av( );")]
|
||||
[LuaMethod("pause_av", "If currently capturing Audio/Video, this will suspend the record. Frames will not be captured into the AV until client.unpause_av() is called")]
|
||||
public static void PauseAv()
|
||||
{
|
||||
GlobalWin.MainForm.PauseAvi = true;
|
||||
}
|
||||
|
||||
[LuaMethodExample("client.reboot_core( );")]
|
||||
[LuaMethod("reboot_core", "Reboots the currently loaded core")]
|
||||
public static void RebootCore()
|
||||
{
|
||||
|
@ -218,12 +261,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
((LuaConsole)GlobalWin.Tools.Get<LuaConsole>()).LuaImp.IsRebootingCore = false;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local incliscr = client.screenheight( );")]
|
||||
[LuaMethod("screenheight", "Gets the current height in pixels of the emulator's drawing area")]
|
||||
public static int ScreenHeight()
|
||||
{
|
||||
return GlobalWin.MainForm.PresentationPanel.NativeSize.Height;
|
||||
}
|
||||
|
||||
[LuaMethodExample("client.screenshot( \"C:\\\" );")]
|
||||
[LuaMethod("screenshot", "if a parameter is passed it will function as the Screenshot As menu item of EmuHawk, else it will function as the Screenshot menu item")]
|
||||
public static void Screenshot(string path = null)
|
||||
{
|
||||
|
@ -237,30 +282,35 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("client.screenshottoclipboard( );")]
|
||||
[LuaMethod("screenshottoclipboard", "Performs the same function as EmuHawk's Screenshot To Clipboard menu item")]
|
||||
public static void ScreenshotToClipboard()
|
||||
{
|
||||
GlobalWin.MainForm.TakeScreenshotToClipboard();
|
||||
}
|
||||
|
||||
[LuaMethodExample("client.settargetscanlineintensity( -1000 );")]
|
||||
[LuaMethod("settargetscanlineintensity", "Sets the current scanline intensity setting, used for the scanline display filter")]
|
||||
public static void SetTargetScanlineIntensity(int val)
|
||||
{
|
||||
Global.Config.TargetScanlineFilterIntensity = val;
|
||||
}
|
||||
|
||||
[LuaMethodExample("client.setscreenshotosd( true );")]
|
||||
[LuaMethod("setscreenshotosd", "Sets the screenshot Capture OSD property of the client")]
|
||||
public static void SetScreenshotOSD(bool value)
|
||||
{
|
||||
Global.Config.Screenshot_CaptureOSD = value;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local incliscr = client.screenwidth( );")]
|
||||
[LuaMethod("screenwidth", "Gets the current width in pixels of the emulator's drawing area")]
|
||||
public static int ScreenWidth()
|
||||
{
|
||||
return GlobalWin.MainForm.PresentationPanel.NativeSize.Width;
|
||||
}
|
||||
|
||||
[LuaMethodExample("client.setwindowsize( 100 );")]
|
||||
[LuaMethod("setwindowsize", "Sets the main window's size to the give value. Accepted values are 1, 2, 3, 4, 5, and 10")]
|
||||
public void SetWindowSize(int size)
|
||||
{
|
||||
|
@ -276,6 +326,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("client.speedmode( 75 );")]
|
||||
[LuaMethod("speedmode", "Sets the speed of the emulator (in terms of percent)")]
|
||||
public void SpeedMode(int percent)
|
||||
{
|
||||
|
@ -289,12 +340,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("client.togglepause( );")]
|
||||
[LuaMethod("togglepause", "Toggles the current pause state")]
|
||||
public static void TogglePause()
|
||||
{
|
||||
GlobalWin.MainForm.TogglePause();
|
||||
}
|
||||
|
||||
|
||||
[LuaMethodExample("local inclitra = client.transformPointX( 16 );")]
|
||||
[LuaMethod("transformPointX", "Transforms an x-coordinate in emulator space to an x-coordinate in client space")]
|
||||
public static int TransformPointX(int x)
|
||||
{
|
||||
|
@ -302,6 +355,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
return GlobalWin.DisplayManager.TransformPoint(point).X;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local inclitra = client.transformPointY( 32 );")]
|
||||
[LuaMethod("transformPointY", "Transforms an y-coordinate in emulator space to an y-coordinate in client space")]
|
||||
public static int TransformPointY(int y)
|
||||
{
|
||||
|
@ -309,30 +363,35 @@ namespace BizHawk.Client.EmuHawk
|
|||
return GlobalWin.DisplayManager.TransformPoint(point).Y;
|
||||
}
|
||||
|
||||
[LuaMethodExample("client.unpause( );")]
|
||||
[LuaMethod("unpause", "Unpauses the emulator")]
|
||||
public static void Unpause()
|
||||
{
|
||||
GlobalWin.MainForm.UnpauseEmulator();
|
||||
}
|
||||
|
||||
[LuaMethodExample("client.unpause_av( );")]
|
||||
[LuaMethod("unpause_av", "If currently capturing Audio/Video this resumes capturing")]
|
||||
public static void UnpauseAv()
|
||||
{
|
||||
GlobalWin.MainForm.PauseAvi = false;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local inclixpo = client.xpos( );")]
|
||||
[LuaMethod("xpos", "Returns the x value of the screen position where the client currently sits")]
|
||||
public static int Xpos()
|
||||
{
|
||||
return GlobalWin.MainForm.DesktopLocation.X;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local incliypo = client.ypos( );")]
|
||||
[LuaMethod("ypos", "Returns the y value of the screen position where the client currently sits")]
|
||||
public static int Ypos()
|
||||
{
|
||||
return GlobalWin.MainForm.DesktopLocation.Y;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local nlcliget = client.getavailabletools( );")]
|
||||
[LuaMethod("getavailabletools", "Returns a list of the tools currently open")]
|
||||
public LuaTable GetAvailableTools()
|
||||
{
|
||||
|
@ -346,10 +405,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
return t;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local nlcliget = client.gettool( \"Tool name\" );")]
|
||||
[LuaMethod("gettool", "Returns an object that represents a tool of the given name (not case sensitive). If the tool is not open, it will be loaded if available. Use gettools to get a list of names")]
|
||||
public LuaTable GetTool(string name)
|
||||
{
|
||||
var toolType = ReflectionUtil.GetTypeByName(name)
|
||||
var toolType = ReflectionUtil.GetTypeByName(name)
|
||||
.FirstOrDefault(x => typeof(IToolForm).IsAssignableFrom(x) && !x.IsInterface);
|
||||
|
||||
if (toolType != null)
|
||||
|
@ -368,6 +428,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
return null;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local nlclicre = client.createinstance( \"objectname\" );")]
|
||||
[LuaMethod("createinstance", "returns a default instance of the given type of object if it exists (not case sensitive). Note: This will only work on objects which have a parameterless constructor. If no suitable type is found, or the type does not have a parameterless constructor, then nil is returned")]
|
||||
public LuaTable CreateInstance(string name)
|
||||
{
|
||||
|
@ -382,12 +443,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
return null;
|
||||
}
|
||||
|
||||
[LuaMethodExample("client.displaymessages( true );")]
|
||||
[LuaMethod("displaymessages", "sets whether or not on screen messages will display")]
|
||||
public void DisplayMessages(bool value)
|
||||
{
|
||||
Global.Config.DisplayMessages = value;
|
||||
}
|
||||
|
||||
[LuaMethodExample("client.saveram( );")]
|
||||
[LuaMethod("saveram", "flushes save ram to disk")]
|
||||
public void SaveRam()
|
||||
{
|
||||
|
|
|
@ -0,0 +1,161 @@
|
|||
using System;
|
||||
using System.ComponentModel;
|
||||
using NLua;
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Client.Common;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Windows.Forms;
|
||||
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
[Description("A library for communicating with other programs")]
|
||||
public sealed class CommunicationLuaLibrary : LuaLibraryBase
|
||||
{
|
||||
[RequiredService]
|
||||
private IEmulator Emulator { get; set; }
|
||||
|
||||
[RequiredService]
|
||||
private IVideoProvider VideoProvider { get; set; }
|
||||
|
||||
public CommunicationLuaLibrary(Lua lua)
|
||||
: base(lua) { }
|
||||
|
||||
public CommunicationLuaLibrary(Lua lua, Action<string> logOutputCallback)
|
||||
: base(lua, logOutputCallback) { }
|
||||
|
||||
public override string Name => "comm";
|
||||
|
||||
//TO DO: not fully working yet!
|
||||
[LuaMethod("getluafunctionslist", "returns a list of implemented functions")]
|
||||
public static string GetLuaFunctionsList()
|
||||
{
|
||||
var list = new StringBuilder();
|
||||
foreach (var function in typeof(CommunicationLuaLibrary).GetMethods())
|
||||
{
|
||||
list.AppendLine(function.ToString());
|
||||
}
|
||||
|
||||
return list.ToString();
|
||||
}
|
||||
|
||||
[LuaMethod("socketServerScreenShot", "sends a screenshot to the Socket server")]
|
||||
public string SocketServerScreenShot()
|
||||
{
|
||||
return GlobalWin.socketServer.SendScreenshot();
|
||||
}
|
||||
[LuaMethod("socketServerScreenShotResponse", "sends a screenshot to the Socket server and retrieves the response")]
|
||||
public string SocketServerScreenShotResponse()
|
||||
{
|
||||
return GlobalWin.socketServer.SendScreenshot(1000).ToString();
|
||||
}
|
||||
|
||||
[LuaMethod("socketServerSend", "sends a string to the Socket server")]
|
||||
public string SocketServerSend(string SendString)
|
||||
{
|
||||
return "Sent : " + GlobalWin.socketServer.SendString(SendString).ToString() + " bytes";
|
||||
}
|
||||
[LuaMethod("socketServerResponse", "receives a message from the Socket server")]
|
||||
public string SocketServerResponse()
|
||||
{
|
||||
return GlobalWin.socketServer.ReceiveMessage();
|
||||
}
|
||||
|
||||
[LuaMethod("socketServerSuccessful", "returns the status of the last Socket server action")]
|
||||
public bool SocketServerSuccessful()
|
||||
{
|
||||
return GlobalWin.socketServer.Successful();
|
||||
}
|
||||
[LuaMethod("socketServerSetTimeout", "sets the timeout in milliseconds for receiving messages")]
|
||||
public void SocketServerSetTimeout(int timeout)
|
||||
{
|
||||
GlobalWin.socketServer.SetTimeout(timeout);
|
||||
}
|
||||
// All MemoryMappedFile related methods
|
||||
[LuaMethod("mmfSetFilename", "Sets the filename for the screenshots")]
|
||||
public void MmfSetFilename(string filename)
|
||||
{
|
||||
GlobalWin.memoryMappedFiles.SetFilename(filename);
|
||||
}
|
||||
[LuaMethod("mmfGetFilename", "Gets the filename for the screenshots")]
|
||||
public string MmfSetFilename()
|
||||
{
|
||||
return GlobalWin.memoryMappedFiles.GetFilename();
|
||||
}
|
||||
|
||||
[LuaMethod("mmfScreenshot", "Saves screenshot to memory mapped file")]
|
||||
public int MmfScreenshot()
|
||||
{
|
||||
return GlobalWin.memoryMappedFiles.ScreenShotToFile();
|
||||
}
|
||||
|
||||
[LuaMethod("mmfWrite", "Writes a string to a memory mapped file")]
|
||||
public int MmfWrite(string mmf_filename, string outputString)
|
||||
{
|
||||
return GlobalWin.memoryMappedFiles.WriteToFile(mmf_filename, Encoding.ASCII.GetBytes(outputString));
|
||||
}
|
||||
[LuaMethod("mmfRead", "Reads a string from a memory mapped file")]
|
||||
public string MmfRead(string mmf_filename, int expectedSize)
|
||||
{
|
||||
return GlobalWin.memoryMappedFiles.ReadFromFile(mmf_filename, expectedSize).ToString();
|
||||
}
|
||||
// All HTTP related methods
|
||||
[LuaMethod("httpTest", "tests HTTP connections")]
|
||||
public string HttpTest()
|
||||
{
|
||||
var list = new StringBuilder();
|
||||
list.AppendLine(GlobalWin.httpCommunication.TestGet());
|
||||
list.AppendLine(GlobalWin.httpCommunication.SendScreenshot());
|
||||
list.AppendLine("done testing");
|
||||
return list.ToString();
|
||||
}
|
||||
[LuaMethod("httpTestGet", "tests the HTTP GET connection")]
|
||||
public string HttpTestGet()
|
||||
{
|
||||
return GlobalWin.httpCommunication.TestGet();
|
||||
}
|
||||
[LuaMethod("httpGet", "makes a HTTP GET request")]
|
||||
public string HttpGet(string url)
|
||||
{
|
||||
return GlobalWin.httpCommunication.ExecGet(url);
|
||||
}
|
||||
|
||||
[LuaMethod("httpPost", "makes a HTTP POST request")]
|
||||
public string HttpPost(string url, string payload)
|
||||
{
|
||||
return GlobalWin.httpCommunication.ExecPost(url, payload);
|
||||
}
|
||||
[LuaMethod("httpPostScreenshot", "HTTP POST screenshot")]
|
||||
public string HttpPostScreenshot()
|
||||
{
|
||||
return GlobalWin.httpCommunication.SendScreenshot();
|
||||
}
|
||||
[LuaMethod("httpSetTimeout", "Sets HTTP timeout in milliseconds")]
|
||||
public void HttpSetTimeout(int timeout)
|
||||
{
|
||||
GlobalWin.httpCommunication.SetTimeout(timeout);
|
||||
}
|
||||
[LuaMethod("httpSetPostUrl", "Sets HTTP POST URL")]
|
||||
public void HttpSetPostUrl(string url)
|
||||
{
|
||||
GlobalWin.httpCommunication.SetPostUrl(url);
|
||||
}
|
||||
[LuaMethod("httpSetGetUrl", "Sets HTTP GET URL")]
|
||||
public void HttpSetGetUrl(string url)
|
||||
{
|
||||
GlobalWin.httpCommunication.SetGetUrl(url);
|
||||
}
|
||||
[LuaMethod("httpGetPostUrl", "Gets HTTP POST URL")]
|
||||
public string HttpGetPostUrl()
|
||||
{
|
||||
return GlobalWin.httpCommunication.GetPostUrl();
|
||||
}
|
||||
[LuaMethod("httpGetGetUrl", "Gets HTTP GET URL")]
|
||||
public string HttpGetGetUrl()
|
||||
{
|
||||
return GlobalWin.httpCommunication.GetGetUrl();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,6 +18,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public override string Name => "console";
|
||||
|
||||
[LuaMethodExample("console.clear( );")]
|
||||
[LuaMethod("clear", "clears the output box of the Lua Console window")]
|
||||
public static void Clear()
|
||||
{
|
||||
|
@ -27,6 +28,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("local stconget = console.getluafunctionslist( );")]
|
||||
[LuaMethod("getluafunctionslist", "returns a list of implemented functions")]
|
||||
public static string GetLuaFunctionsList()
|
||||
{
|
||||
|
@ -39,6 +41,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
return list.ToString();
|
||||
}
|
||||
|
||||
[LuaMethodExample("console.log( \"New log.\" );")]
|
||||
[LuaMethod("log", "Outputs the given object to the output box on the Lua Console dialog. Note: Can accept a LuaTable")]
|
||||
public static void Log(params object[] outputs)
|
||||
{
|
||||
|
@ -57,6 +60,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("console.writeline( \"New log line.\" );")]
|
||||
[LuaMethod("writeline", "Outputs the given object to the output box on the Lua Console dialog. Note: Can accept a LuaTable")]
|
||||
public static void WriteLine(params object[] outputs)
|
||||
{
|
||||
|
@ -66,6 +70,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("console.write( \"New log message.\" );")]
|
||||
[LuaMethod("write", "Outputs the given object to the output box on the Lua Console dialog. Note: Can accept a LuaTable")]
|
||||
public static void Write(params object[] outputs)
|
||||
{
|
||||
|
|
|
@ -62,6 +62,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
#endregion
|
||||
|
||||
[LuaMethodExample("forms.addclick( 332, function()\r\n\tconsole.log( \"adds the given lua function as a click event to the given control\" );\r\nend );")]
|
||||
[LuaMethod("addclick", "adds the given lua function as a click event to the given control")]
|
||||
public void AddClick(int handle, LuaFunction clickEvent)
|
||||
{
|
||||
|
@ -78,6 +79,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("local inforbut = forms.button( 333, \"Caption\", function()\r\n\tconsole.log( \"Creates a button control on the given form. The caption property will be the text value on the button. clickEvent is the name of a Lua function that will be invoked when the button is clicked. x, and y are the optional location parameters for the position of the button within the given form. The function returns the handle of the created button. Width and Height are optional, if not specified they will be a default size\" );\r\nend, 2, 48, 18, 24 );")]
|
||||
[LuaMethod(
|
||||
"button", "Creates a button control on the given form. The caption property will be the text value on the button. clickEvent is the name of a Lua function that will be invoked when the button is clicked. x, and y are the optional location parameters for the position of the button within the given form. The function returns the handle of the created button. Width and Height are optional, if not specified they will be a default size")]
|
||||
public int Button(
|
||||
|
@ -113,6 +115,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
return (int)button.Handle;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local inforche = forms.checkbox( 333, \"Caption\", 2, 48 );")]
|
||||
[LuaMethod(
|
||||
"checkbox", "Creates a checkbox control on the given form. The caption property will be the text of the checkbox. x and y are the optional location parameters for the position of the checkbox within the form")]
|
||||
public int Checkbox(int formHandle, string caption, int? x = null, int? y = null)
|
||||
|
@ -135,6 +138,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
return (int)checkbox.Handle;
|
||||
}
|
||||
|
||||
[LuaMethodExample("forms.clearclicks( 332 );")]
|
||||
[LuaMethod("clearclicks", "Removes all click events from the given widget at the specified handle")]
|
||||
public void ClearClicks(int handle)
|
||||
{
|
||||
|
@ -155,6 +159,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( forms.destroy( 332 ) ) then\r\n\tconsole.log( \"Closes and removes a Lua created form with the specified handle. If a dialog was found and removed true is returned, else false\" );\r\nend;")]
|
||||
[LuaMethod("destroy", "Closes and removes a Lua created form with the specified handle. If a dialog was found and removed true is returned, else false")]
|
||||
public bool Destroy(int handle)
|
||||
{
|
||||
|
@ -172,6 +177,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
return false;
|
||||
}
|
||||
|
||||
[LuaMethodExample("forms.destroyall();")]
|
||||
[LuaMethod("destroyall", "Closes and removes all Lua created dialogs")]
|
||||
public void DestroyAll()
|
||||
{
|
||||
|
@ -181,6 +187,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("local infordro = forms.dropdown(333, { \"item 1\", \"item2\" }, 2, 48, 18, 24);")]
|
||||
[LuaMethod(
|
||||
"dropdown", "Creates a dropdown (with a ComboBoxStyle of DropDownList) control on the given form. Dropdown items are passed via a lua table. Only the values will be pulled for the dropdown items, the keys are irrelevant. Items will be sorted alphabetically. x and y are the optional location parameters, and width and height are the optional size parameters.")]
|
||||
public int Dropdown(
|
||||
|
@ -216,6 +223,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
return (int)dropdown.Handle;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local stforget = forms.getproperty(332, \"Property\");")]
|
||||
[LuaMethod("getproperty", "returns a string representation of the value of a property of the widget at the given handle")]
|
||||
public string GetProperty(int handle, string property)
|
||||
{
|
||||
|
@ -246,6 +254,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
return "";
|
||||
}
|
||||
|
||||
[LuaMethodExample("local stforget = forms.gettext(332);")]
|
||||
[LuaMethod("gettext", "Returns the text property of a given form or control")]
|
||||
public string GetText(int handle)
|
||||
{
|
||||
|
@ -281,6 +290,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
return "";
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( forms.ischecked( 332 ) ) then\r\n\tconsole.log( \"Returns the given checkbox's checked property\" );\r\nend;")]
|
||||
[LuaMethod("ischecked", "Returns the given checkbox's checked property")]
|
||||
public bool IsChecked(int handle)
|
||||
{
|
||||
|
@ -309,6 +319,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
return false;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local inforlab = forms.label( 333, \"Caption\", 2, 48, 18, 24, false );")]
|
||||
[LuaMethod(
|
||||
"label", "Creates a label control on the given form. The caption property is the text of the label. x, and y are the optional location parameters for the position of the label within the given form. The function returns the handle of the created label. Width and Height are optional, if not specified they will be a default size.")]
|
||||
public int Label(
|
||||
|
@ -348,6 +359,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
return (int)label.Handle;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local infornew = forms.newform( 18, 24, \"Title\", function()\r\n\tconsole.log( \"creates a new default dialog, if both width and height are specified it will create a dialog of the specified size. If title is specified it will be the caption of the dialog, else the dialog caption will be 'Lua Dialog'. The function will return an int representing the handle of the dialog created.\" );\r\nend );")]
|
||||
[LuaMethod(
|
||||
"newform", "creates a new default dialog, if both width and height are specified it will create a dialog of the specified size. If title is specified it will be the caption of the dialog, else the dialog caption will be 'Lua Dialog'. The function will return an int representing the handle of the dialog created.")]
|
||||
public int NewForm(int? width = null, int? height = null, string title = null, LuaFunction onClose = null)
|
||||
|
@ -383,6 +395,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
return (int)form.Handle;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local stforope = forms.openfile( \"C:\\filename.bin\", \"C:\\\", \"All files ( *.* )|*.*\");")]
|
||||
[LuaMethod(
|
||||
"openfile", "Creates a standard openfile dialog with optional parameters for the filename, directory, and filter. The return value is the directory that the user picked. If they chose to cancel, it will return an empty string")]
|
||||
public string OpenFile(string fileName = null, string initialDirectory = null, string filter = "All files (*.*)|*.*")
|
||||
|
@ -413,6 +426,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
return "";
|
||||
}
|
||||
|
||||
[LuaMethodExample("local inforpic = forms.pictureBox( 333, 2, 48, 18, 24 );")]
|
||||
[LuaMethod(
|
||||
"pictureBox",
|
||||
"Creates a new drawing area in the form. Optionally the location in the form as well as the size of the drawing area can be specified. Returns the handle the component can be refered to with.")]
|
||||
|
@ -444,6 +458,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
#region LuaPictureBox Methods
|
||||
|
||||
[LuaMethodExample("forms.clear( 334, 0x000000FF );")]
|
||||
[LuaMethod(
|
||||
"clear",
|
||||
"Clears the canvas")]
|
||||
|
@ -475,6 +490,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("forms.refresh( 334 );")]
|
||||
[LuaMethod(
|
||||
"refresh",
|
||||
"Redraws the canvas")]
|
||||
|
@ -506,6 +522,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("forms.setDefaultForegroundColor( 334, 0xFFFFFFFF );")]
|
||||
[LuaMethod(
|
||||
"setDefaultForegroundColor",
|
||||
"Sets the default foreground color to use in drawing methods, white by default")]
|
||||
|
@ -537,6 +554,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("forms.setDefaultBackgroundColor( 334, 0x000000FF );")]
|
||||
[LuaMethod(
|
||||
"setDefaultBackgroundColor",
|
||||
"Sets the default background color to use in drawing methods, transparent by default")]
|
||||
|
@ -568,6 +586,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("forms.setDefaultTextBackground( 334, 0x000000FF );")]
|
||||
[LuaMethod(
|
||||
"setDefaultTextBackground",
|
||||
"Sets the default backgroiund color to use in text drawing methods, half-transparent black by default")]
|
||||
|
@ -599,6 +618,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("forms.drawBezier( 334, { { 5, 10 }, { 10, 10 }, { 10, 20 }, { 5, 20 } }, 0x000000FF );")]
|
||||
[LuaMethod(
|
||||
"drawBezier",
|
||||
"Draws a Bezier curve using the table of coordinates provided in the given color")]
|
||||
|
@ -630,6 +650,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("forms.drawBox( 334, 16, 32, 162, 322, 0x007F00FF, 0x7F7F7FFF );")]
|
||||
[LuaMethod(
|
||||
"drawBox",
|
||||
"Draws a rectangle on screen from x1/y1 to x2/y2. Same as drawRectangle except it receives two points intead of a point and width/height")]
|
||||
|
@ -661,6 +682,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("forms.drawEllipse( 334, 16, 32, 77, 99, 0x007F00FF, 0x7F7F7FFF );")]
|
||||
[LuaMethod(
|
||||
"drawEllipse",
|
||||
"Draws an ellipse at the given coordinates and the given width and height. Line is the color of the ellipse. Background is the optional fill color")]
|
||||
|
@ -692,6 +714,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("forms.drawIcon( 334, \"C:\\icon.ico\", 16, 32, 18, 24 );")]
|
||||
[LuaMethod(
|
||||
"drawIcon",
|
||||
"draws an Icon (.ico) file from the given path at the given coordinate. width and height are optional. If specified, it will resize the image accordingly")]
|
||||
|
@ -723,6 +746,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("forms.drawImage( 334, \"C:\\image.png\", 16, 32, 18, 24, false );")]
|
||||
[LuaMethod(
|
||||
"drawImage",
|
||||
"draws an image file from the given path at the given coordinate. width and height are optional. If specified, it will resize the image accordingly")]
|
||||
|
@ -759,6 +783,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("forms.clearImageCache( 334 );")]
|
||||
[LuaMethod(
|
||||
"clearImageCache",
|
||||
"clears the image cache that is built up by using gui.drawImage, also releases the file handle for cached images")]
|
||||
|
@ -790,6 +815,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("forms.drawImageRegion( 334, \"C:\\image.bmp\", 11, 22, 33, 44, 21, 43, 34, 45 );")]
|
||||
[LuaMethod(
|
||||
"drawImageRegion",
|
||||
"draws a given region of an image file from the given path at the given coordinate, and optionally with the given size")]
|
||||
|
@ -826,6 +852,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("forms.drawLine( 334, 161, 321, 162, 322, 0xFFFFFFFF );")]
|
||||
[LuaMethod(
|
||||
"drawLine",
|
||||
"Draws a line from the first coordinate pair to the 2nd. Color is optional (if not specified it will be drawn black)")]
|
||||
|
@ -857,6 +884,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("forms.drawAxis( 334, 16, 32, int size, 0xFFFFFFFF );")]
|
||||
[LuaMethod(
|
||||
"drawAxis",
|
||||
"Draws an axis of the specified size at the coordinate pair.)")]
|
||||
|
@ -888,6 +916,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("forms.drawArc( 334, 16, 32, 77, 99, 180, 90, 0x007F00FF );")]
|
||||
[LuaMethod(
|
||||
"drawArc",
|
||||
"draws a Arc shape at the given coordinates and the given width and height"
|
||||
|
@ -920,6 +949,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("forms.drawPie( 334, 16, 32, 77, 99, 180, 90, 0x007F00FF, 0x7F7F7FFF );")]
|
||||
[LuaMethod(
|
||||
"drawPie",
|
||||
"draws a Pie shape at the given coordinates and the given width and height")]
|
||||
|
@ -960,6 +990,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("forms.drawPixel( 334, 16, 32, 0xFFFFFFFF );")]
|
||||
[LuaMethod(
|
||||
"drawPixel",
|
||||
"Draws a single pixel at the given coordinates in the given color. Color is optional (if not specified it will be drawn black)")]
|
||||
|
@ -991,6 +1022,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("forms.drawPolygon( 334, { { 5, 10 }, { 10, 10 }, { 10, 20 }, { 5, 20 } }, 0x007F00FF, 0x7F7F7FFF );")]
|
||||
[LuaMethod(
|
||||
"drawPolygon",
|
||||
"Draws a polygon using the table of coordinates specified in points. This should be a table of tables(each of size 2). Line is the color of the polygon. Background is the optional fill color")]
|
||||
|
@ -1023,6 +1055,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
|
||||
[LuaMethodExample("forms.drawRectangle( 334, 16, 32, 77, 99, 0x007F00FF, 0x7F7F7FFF );")]
|
||||
[LuaMethod(
|
||||
"drawRectangle",
|
||||
"Draws a rectangle at the given coordinate and the given width and height. Line is the color of the box. Background is the optional fill color")]
|
||||
|
@ -1054,6 +1087,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("forms.drawString( 334, 16, 32, \"Some message\", 0x7F0000FF, 0x00007FFF, 8, \"Arial Narrow\", \"bold\", \"center\", \"middle\" );")]
|
||||
[LuaMethod(
|
||||
"drawString",
|
||||
"Alias of DrawText()")]
|
||||
|
@ -1096,6 +1130,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("forms.drawText( 334, 16, 32, \"Some message\", 0x7F0000FF, 0x00007FFF, 8, \"Arial Narrow\", \"bold\", \"center\", \"middle\" );")]
|
||||
[LuaMethod(
|
||||
"drawText",
|
||||
"Draws the given message at the given x,y coordinates and the given color. The default color is white. A fontfamily can be specified and is monospace generic if none is specified (font family options are the same as the .NET FontFamily class). The fontsize default is 12. The default font style is regular. Font style options are regular, bold, italic, strikethrough, underline. Horizontal alignment options are left (default), center, or right. Vertical alignment options are bottom (default), middle, or top. Alignment options specify which ends of the text will be drawn at the x and y coordinates.")]
|
||||
|
@ -1139,6 +1174,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
// It'd be great if these were simplified into 1 function, but I cannot figure out how to return a LuaTable from this class
|
||||
[LuaMethodExample("local inforget = forms.getMouseX( 334 );")]
|
||||
[LuaMethod(
|
||||
"getMouseX",
|
||||
"Returns an integer representation of the mouse X coordinate relative to the PictureBox.")]
|
||||
|
@ -1173,6 +1209,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
return 0;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local inforget = forms.getMouseY( 334 );")]
|
||||
[LuaMethod(
|
||||
"getMouseY",
|
||||
"Returns an integer representation of the mouse Y coordinate relative to the PictureBox.")]
|
||||
|
@ -1209,6 +1246,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
#endregion
|
||||
|
||||
[LuaMethodExample("forms.setdropdownitems( 332, { \"item1\", \"item2\" } );")]
|
||||
[LuaMethod("setdropdownitems", "Sets the items for a given dropdown box")]
|
||||
public void SetDropdownItems(int handle, LuaTable items)
|
||||
{
|
||||
|
@ -1244,6 +1282,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("forms.setlocation( 332, 16, 32 );")]
|
||||
[LuaMethod("setlocation", "Sets the location of a control or form by passing in the handle of the created object")]
|
||||
public void SetLocation(int handle, int x, int y)
|
||||
{
|
||||
|
@ -1267,6 +1306,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("forms.setproperty( 332, \"Property\", \"Property value\" );")]
|
||||
[LuaMethod("setproperty", "Attempts to set the given property of the widget with the given value. Note: not all properties will be able to be represented for the control to accept")]
|
||||
public void SetProperty(int handle, string property, object value)
|
||||
{
|
||||
|
@ -1322,12 +1362,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("local coforcre = forms.createcolor( 0x7F, 0x3F, 0x1F, 0xCF );")]
|
||||
[LuaMethod("createcolor", "Creates a color object useful with setproperty")]
|
||||
public Color CreateColor(int r, int g, int b, int a)
|
||||
{
|
||||
return Color.FromArgb(a, r, g, b);
|
||||
}
|
||||
|
||||
[LuaMethodExample("forms.setsize( 332, 77, 99 );")]
|
||||
[LuaMethod("setsize", "TODO")]
|
||||
public void SetSize(int handle, int width, int height)
|
||||
{
|
||||
|
@ -1351,6 +1393,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("forms.settext( 332, \"Caption\" );")]
|
||||
[LuaMethod("settext", "Sets the text property of a control or form by passing in the handle of the created object")]
|
||||
public void Settext(int handle, string caption)
|
||||
{
|
||||
|
@ -1374,6 +1417,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("local infortex = forms.textbox( 333, \"Caption\", 18, 24, \"HEX\", 2, 48, true, false, \"Both\" );")]
|
||||
[LuaMethod(
|
||||
"textbox", "Creates a textbox control on the given form. The caption property will be the initial value of the textbox (default is empty). Width and Height are option, if not specified they will be a default size of 100, 20. Type is an optional property to restrict the textbox input. The available options are HEX, SIGNED, and UNSIGNED. Passing it null or any other value will set it to no restriction. x, and y are the optional location parameters for the position of the textbox within the given form. The function returns the handle of the created textbox. If true, the multiline will enable the standard winform multi-line property. If true, the fixedWidth options will create a fixed width font. Scrollbars is an optional property to specify which scrollbars to display. The available options are Vertical, Horizontal, Both, and None. Scrollbars are only shown on a multiline textbox")]
|
||||
public int Textbox(
|
||||
|
|
|
@ -45,6 +45,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public bool SurfaceIsNull => _luaSurface == null;
|
||||
|
||||
[LuaMethodExample("gui.DrawNew( \"native\", false );")]
|
||||
[LuaMethod("DrawNew", "Changes drawing target to the specified lua surface name. This may clobber any previous drawing to this surface (pass false if you don't want it to)")]
|
||||
public void DrawNew(string name, bool? clear = true)
|
||||
{
|
||||
|
@ -59,6 +60,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("gui.DrawFinish( );")]
|
||||
[LuaMethod("DrawFinish", "Finishes drawing to the current lua surface and causes it to get displayed.")]
|
||||
public void DrawFinish()
|
||||
{
|
||||
|
@ -126,12 +128,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
#endregion
|
||||
|
||||
[LuaMethodExample("gui.addmessage( \"Some message\" );")]
|
||||
[LuaMethod("addmessage", "Adds a message to the OSD's message area")]
|
||||
public void AddMessage(string message)
|
||||
{
|
||||
GlobalWin.OSD.AddMessage(message);
|
||||
}
|
||||
|
||||
[LuaMethodExample("gui.clearGraphics( );")]
|
||||
[LuaMethod("clearGraphics", "clears all lua drawn graphics from the screen")]
|
||||
public void ClearGraphics()
|
||||
{
|
||||
|
@ -139,30 +143,35 @@ namespace BizHawk.Client.EmuHawk
|
|||
DrawFinish();
|
||||
}
|
||||
|
||||
[LuaMethodExample("gui.cleartext( );")]
|
||||
[LuaMethod("cleartext", "clears all text created by gui.text()")]
|
||||
public static void ClearText()
|
||||
{
|
||||
GlobalWin.OSD.ClearGUIText();
|
||||
}
|
||||
|
||||
[LuaMethodExample("gui.defaultForeground( 0x000000FF );")]
|
||||
[LuaMethod("defaultForeground", "Sets the default foreground color to use in drawing methods, white by default")]
|
||||
public void SetDefaultForegroundColor(Color color)
|
||||
{
|
||||
_defaultForeground = color;
|
||||
}
|
||||
|
||||
[LuaMethodExample("gui.defaultBackground( 0xFFFFFFFF );")]
|
||||
[LuaMethod("defaultBackground", "Sets the default background color to use in drawing methods, transparent by default")]
|
||||
public void SetDefaultBackgroundColor(Color color)
|
||||
{
|
||||
_defaultBackground = color;
|
||||
}
|
||||
|
||||
[LuaMethodExample("gui.defaultTextBackground( 0x000000FF );")]
|
||||
[LuaMethod("defaultTextBackground", "Sets the default backgroiund color to use in text drawing methods, half-transparent black by default")]
|
||||
public void SetDefaultTextBackground(Color color)
|
||||
{
|
||||
_defaultTextBackground = color;
|
||||
}
|
||||
|
||||
[LuaMethodExample("gui.defaultPixelFont( \"Arial Narrow\");")]
|
||||
[LuaMethod("defaultPixelFont", "Sets the default font to use in gui.pixelText(). Two font families are available, \"fceux\" and \"gens\" (or \"0\" and \"1\" respectively), \"gens\" is used by default")]
|
||||
public void SetDefaultTextBackground(string fontfamily)
|
||||
{
|
||||
|
@ -182,6 +191,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("gui.drawBezier( { { 5, 10 }, { 10, 10 }, { 10, 20 }, { 5, 20 } }, 0x000000FF );")]
|
||||
[LuaMethod("drawBezier", "Draws a Bezier curve using the table of coordinates provided in the given color")]
|
||||
public void DrawBezier(LuaTable points, Color color)
|
||||
{
|
||||
|
@ -190,7 +200,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
try
|
||||
{
|
||||
var pointsArr = new Point[4];
|
||||
|
||||
|
||||
var i = 0;
|
||||
foreach (LuaTable point in points.Values)
|
||||
{
|
||||
|
@ -211,6 +221,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("gui.drawBox( 16, 32, 162, 322, 0x007F00FF, 0x7F7F7FFF );")]
|
||||
[LuaMethod("drawBox", "Draws a rectangle on screen from x1/y1 to x2/y2. Same as drawRectangle except it receives two points intead of a point and width/height")]
|
||||
public void DrawBox(int x, int y, int x2, int y2, Color? line = null, Color? background = null)
|
||||
{
|
||||
|
@ -254,6 +265,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("gui.drawEllipse( 16, 32, 77, 99, 0x007F00FF, 0x7F7F7FFF );")]
|
||||
[LuaMethod("drawEllipse", "Draws an ellipse at the given coordinates and the given width and height. Line is the color of the ellipse. Background is the optional fill color")]
|
||||
public void DrawEllipse(int x, int y, int width, int height, Color? line = null, Color? background = null)
|
||||
{
|
||||
|
@ -278,6 +290,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("gui.drawIcon( \"C:\\sample.ico\", 16, 32, 18, 24 );")]
|
||||
[LuaMethod("drawIcon", "draws an Icon (.ico) file from the given path at the given coordinate. width and height are optional. If specified, it will resize the image accordingly")]
|
||||
public void DrawIcon(string path, int x, int y, int? width = null, int? height = null)
|
||||
{
|
||||
|
@ -304,6 +317,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("gui.drawImage( \"C:\\sample.bmp\", 16, 32, 18, 24, false );")]
|
||||
[LuaMethod("drawImage", "draws an image file from the given path at the given coordinate. width and height are optional. If specified, it will resize the image accordingly")]
|
||||
public void DrawImage(string path, int x, int y, int? width = null, int? height = null, bool cache = true)
|
||||
{
|
||||
|
@ -333,6 +347,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("gui.clearImageCache( );")]
|
||||
[LuaMethod("clearImageCache", "clears the image cache that is built up by using gui.drawImage, also releases the file handle for cached images")]
|
||||
public void ClearImageCache()
|
||||
{
|
||||
|
@ -344,6 +359,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
_imageCache.Clear();
|
||||
}
|
||||
|
||||
[LuaMethodExample("gui.drawImageRegion( \"C:\\sample.png\", 11, 22, 33, 44, 21, 43, 34, 45 );")]
|
||||
[LuaMethod("drawImageRegion", "draws a given region of an image file from the given path at the given coordinate, and optionally with the given size")]
|
||||
public void DrawImageRegion(string path, int source_x, int source_y, int source_width, int source_height, int dest_x, int dest_y, int? dest_width = null, int? dest_height = null)
|
||||
{
|
||||
|
@ -372,6 +388,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("gui.drawLine( 161, 321, 162, 322, 0xFFFFFFFF );")]
|
||||
[LuaMethod("drawLine", "Draws a line from the first coordinate pair to the 2nd. Color is optional (if not specified it will be drawn black)")]
|
||||
public void DrawLine(int x1, int y1, int x2, int y2, Color? color = null)
|
||||
{
|
||||
|
@ -381,6 +398,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("gui.drawAxis( 16, 32, 15, 0xFFFFFFFF );")]
|
||||
[LuaMethod("drawAxis", "Draws an axis of the specified size at the coordinate pair.)")]
|
||||
public void DrawAxis(int x, int y, int size, Color? color = null)
|
||||
{
|
||||
|
@ -388,6 +406,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
DrawLine(x, y + size, x, y - size, color);
|
||||
}
|
||||
|
||||
[LuaMethodExample("gui.drawPie( 16, 32, 77, 99, 180, 90, 0x007F00FF, 0x7F7F7FFF );")]
|
||||
[LuaMethod("drawPie", "draws a Pie shape at the given coordinates and the given width and height")]
|
||||
public void DrawPie(
|
||||
int x,
|
||||
|
@ -412,6 +431,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("gui.drawPixel( 16, 32, 0xFFFFFFFF );")]
|
||||
[LuaMethod("drawPixel", "Draws a single pixel at the given coordinates in the given color. Color is optional (if not specified it will be drawn black)")]
|
||||
public void DrawPixel(int x, int y, Color? color = null)
|
||||
{
|
||||
|
@ -428,6 +448,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("gui.drawPolygon( { { 5, 10 }, { 10, 10 }, { 10, 20 }, { 5, 20 } }, 0x007F00FF, 0x7F7F7FFF );")]
|
||||
[LuaMethod("drawPolygon", "Draws a polygon using the table of coordinates specified in points. This should be a table of tables(each of size 2). Line is the color of the polygon. Background is the optional fill color")]
|
||||
public void DrawPolygon(LuaTable points, Color? line = null, Color? background = null)
|
||||
{
|
||||
|
@ -457,6 +478,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("gui.drawRectangle( 16, 32, 77, 99, 0x007F00FF, 0x7F7F7FFF );")]
|
||||
[LuaMethod("drawRectangle", "Draws a rectangle at the given coordinate and the given width and height. Line is the color of the box. Background is the optional fill color")]
|
||||
public void DrawRectangle(int x, int y, int width, int height, Color? line = null, Color? background = null)
|
||||
{
|
||||
|
@ -471,6 +493,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("gui.drawString( 16, 32, \"Some message\", 0x7F0000FF, 0x00007FFF, 8, \"Arial Narrow\", \"bold\", \"center\", \"middle\" );")]
|
||||
[LuaMethod("drawString", "Alias of gui.drawText()")]
|
||||
public void DrawString(
|
||||
int x,
|
||||
|
@ -487,6 +510,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
DrawText(x, y, message, forecolor, backcolor, fontsize, fontfamily, fontstyle, horizalign, vertalign);
|
||||
}
|
||||
|
||||
[LuaMethodExample("gui.drawText( 16, 32, \"Some message\", 0x7F0000FF, 0x00007FFF, 8, \"Arial Narrow\", \"bold\", \"center\", \"middle\" );")]
|
||||
[LuaMethod("drawText", "Draws the given message in the emulator screen space (like all draw functions) at the given x,y coordinates and the given color. The default color is white. A fontfamily can be specified and is monospace generic if none is specified (font family options are the same as the .NET FontFamily class). The fontsize default is 12. The default font style is regular. Font style options are regular, bold, italic, strikethrough, underline. Horizontal alignment options are left (default), center, or right. Vertical alignment options are bottom (default), middle, or top. Alignment options specify which ends of the text will be drawn at the x and y coordinates.")]
|
||||
public void DrawText(
|
||||
int x,
|
||||
|
@ -582,6 +606,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("gui.pixelText( 16, 32, \"Some message\", 0x7F0000FF, 0x00007FFF, \"Arial Narrow\" );")]
|
||||
[LuaMethod("pixelText", "Draws the given message in the emulator screen space (like all draw functions) at the given x,y coordinates and the given color. The default color is white. Two font families are available, \"fceux\" and \"gens\" (or \"0\" and \"1\" respectively), both are monospace and have the same size as in the emulaors they've been taken from. If no font family is specified, it uses \"gens\" font, unless that's overridden via gui.defaultPixelFont()")]
|
||||
public void DrawText(
|
||||
int x,
|
||||
|
@ -636,6 +661,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("gui.text( 16, 32, \"Some message\", 0x7F0000FF, \"bottomleft\" );")]
|
||||
[LuaMethod("text", "Displays the given text on the screen at the given coordinates. Optional Foreground color. The optional anchor flag anchors the text to one of the four corners. Anchor flag parameters: topleft, topright, bottomleft, bottomright")]
|
||||
public void Text(
|
||||
int x,
|
||||
|
@ -677,6 +703,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
GlobalWin.OSD.AddGUIText(message, x, y, Color.Black, forecolor ?? Color.White, a);
|
||||
}
|
||||
|
||||
[LuaMethodExample("local nlguicre = gui.createcanvas( 77, 99, 2, 48 );")]
|
||||
[LuaMethod("createcanvas", "Creates a canvas of the given size and, if specified, the given coordinates.")]
|
||||
public LuaTable Text(int width, int height, int? x = null, int? y = null)
|
||||
{
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public override string Name => "input";
|
||||
|
||||
[LuaMethodExample("local nlinpget = input.get( );")]
|
||||
[LuaMethod("get", "Returns a lua table of all the buttons the user is currently pressing on their keyboard and gamepads\nAll buttons that are pressed have their key values set to true; all others remain nil.")]
|
||||
public LuaTable Get()
|
||||
{
|
||||
|
@ -29,6 +30,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
return buttons;
|
||||
}
|
||||
|
||||
[LuaMethodExample("local nlinpget = input.getmouse( );")]
|
||||
[LuaMethod("getmouse", "Returns a lua table of the mouse X/Y coordinates and button states. Table keys are X, Y, Left, Middle, Right, XButton1, XButton2, Wheel.")]
|
||||
public LuaTable GetMouse()
|
||||
{
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
public override string Name => "savestate";
|
||||
|
||||
[LuaMethodExample("savestate.load( \"C:\\state.bin\" );")]
|
||||
[LuaMethod("load", "Loads a savestate with the given path")]
|
||||
public void Load(string path)
|
||||
{
|
||||
|
@ -30,6 +31,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("savestate.loadslot( 7 );")]
|
||||
[LuaMethod("loadslot", "Loads the savestate at the given slot number (must be an integer between 0 and 9)")]
|
||||
public void LoadSlot(int slotNum)
|
||||
{
|
||||
|
@ -39,12 +41,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("savestate.save( \"C:\\state.bin\" );")]
|
||||
[LuaMethod("save", "Saves a state at the given path")]
|
||||
public void Save(string path)
|
||||
{
|
||||
GlobalWin.MainForm.SaveState(path, path, true);
|
||||
}
|
||||
|
||||
[LuaMethodExample("savestate.saveslot( 7 );")]
|
||||
[LuaMethod("saveslot", "Saves a state at the given save slot (must be an integer between 0 and 9)")]
|
||||
public void SaveSlot(int slotNum)
|
||||
{
|
||||
|
|
|
@ -23,18 +23,47 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private TAStudio Tastudio => GlobalWin.Tools.Get<TAStudio>() as TAStudio;
|
||||
|
||||
private struct PendingChanges
|
||||
{
|
||||
public LuaChangeTypes type;
|
||||
public InputChangeTypes inputType;
|
||||
public int frame;
|
||||
public int number;
|
||||
public string button;
|
||||
public bool valueBool;
|
||||
public float valueFloat;
|
||||
};
|
||||
|
||||
public enum LuaChangeTypes
|
||||
{
|
||||
InputChange,
|
||||
InsertFrames,
|
||||
DeleteFrames,
|
||||
};
|
||||
|
||||
public enum InputChangeTypes
|
||||
{
|
||||
Bool,
|
||||
Float,
|
||||
};
|
||||
|
||||
private List<PendingChanges> changeList = new List<PendingChanges>(); //TODO: Initialize it to empty list on a script reload, and have each script have it's own list
|
||||
|
||||
[LuaMethodExample("if ( tastudio.engaged( ) ) then\r\n\tconsole.log( \"returns whether or not tastudio is currently engaged ( active )\" );\r\nend;")]
|
||||
[LuaMethod("engaged", "returns whether or not tastudio is currently engaged (active)")]
|
||||
public bool Engaged()
|
||||
{
|
||||
return GlobalWin.Tools.Has<TAStudio>(); // TODO: eventually tastudio should have an engaged flag
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( tastudio.getrecording( ) ) then\r\n\tconsole.log( \"returns whether or not TAStudio is in recording mode\" );\r\nend;")]
|
||||
[LuaMethod("getrecording", "returns whether or not TAStudio is in recording mode")]
|
||||
public bool GetRecording()
|
||||
{
|
||||
return Tastudio.TasPlaybackBox.RecordingMode;
|
||||
}
|
||||
|
||||
[LuaMethodExample("tastudio.setrecording( true );")]
|
||||
[LuaMethod("setrecording", "sets the recording mode on/off depending on the parameter")]
|
||||
public void SetRecording(bool val)
|
||||
{
|
||||
|
@ -44,12 +73,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("tastudio.togglerecording( );")]
|
||||
[LuaMethod("togglerecording", "toggles tastudio recording mode on/off depending on its current state")]
|
||||
public void SetRecording()
|
||||
{
|
||||
Tastudio.ToggleReadOnly();
|
||||
}
|
||||
|
||||
[LuaMethodExample("tastudio.setbranchtext( \"Some text\", 1 );")]
|
||||
[LuaMethod("setbranchtext", "adds the given message to the existing branch, or to the branch that will be created next if branch index is not specified")]
|
||||
public void SetBranchText(string text, int? index = null)
|
||||
{
|
||||
|
@ -63,6 +94,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("local sttasget = tastudio.getmarker( 500 );")]
|
||||
[LuaMethod("getmarker", "returns the marker text at the given frame, or an empty string if there is no marker for the given frame")]
|
||||
public string GetMarker(int frame)
|
||||
{
|
||||
|
@ -74,10 +106,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
return marker.Message;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
[LuaMethodExample("tastudio.removemarker( 500 );")]
|
||||
[LuaMethod("removemarker", "if there is a marker for the given frame, it will be removed")]
|
||||
public void RemoveMarker(int frame)
|
||||
{
|
||||
|
@ -92,6 +125,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("tastudio.setmarker( 500, \"Some message\" );")]
|
||||
[LuaMethod("setmarker", "Adds or sets a marker at the given frame, with an optional message")]
|
||||
public void SetMarker(int frame, string message = null)
|
||||
{
|
||||
|
@ -110,6 +144,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("local botasisl = tastudio.islag( 500 );")]
|
||||
[LuaMethod("islag", "Returns whether or not the given frame was a lag frame, null if unknown")]
|
||||
public bool? IsLag(int frame)
|
||||
{
|
||||
|
@ -124,6 +159,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
return null;
|
||||
}
|
||||
|
||||
[LuaMethodExample("tastudio.setlag( 500, true );")]
|
||||
[LuaMethod("setlag", "Sets the lag information for the given frame, if the frame does not exist in the lag log, it will be added. If the value is null, the lag information for that frame will be removed")]
|
||||
public void SetLag(int frame, bool? value)
|
||||
{
|
||||
|
@ -133,6 +169,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("if ( tastudio.hasstate( 500 ) ) then\r\n\tconsole.log( \"Returns whether or not the given frame has a savestate associated with it\" );\r\nend;")]
|
||||
[LuaMethod("hasstate", "Returns whether or not the given frame has a savestate associated with it")]
|
||||
public bool HasState(int frame)
|
||||
{
|
||||
|
@ -147,6 +184,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
return false;
|
||||
}
|
||||
|
||||
[LuaMethodExample("tastudio.setplayback( 1500 );")]
|
||||
[LuaMethod("setplayback", "Seeks the given frame (a number) or marker (a string)")]
|
||||
public void SetPlayback(object frame)
|
||||
{
|
||||
|
@ -175,6 +213,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("tastudio.onqueryitembg( function( currentindex, itemname )\r\n\tconsole.log( \"called during the background draw event of the tastudio listview. luaf must be a function that takes 2 params: index, column. The first is the integer row index of the listview, and the 2nd is the string column name. luaf should return a value that can be parsed into a .NET Color object (string color name, or integer value)\" );\r\nend );")]
|
||||
[LuaMethod("onqueryitembg", "called during the background draw event of the tastudio listview. luaf must be a function that takes 2 params: index, column. The first is the integer row index of the listview, and the 2nd is the string column name. luaf should return a value that can be parsed into a .NET Color object (string color name, or integer value)")]
|
||||
public void OnQueryItemBg(LuaFunction luaf)
|
||||
{
|
||||
|
@ -195,6 +234,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("tastudio.onqueryitemtext( function( currentindex, itemname )\r\n\tconsole.log( \"called during the text draw event of the tastudio listview. luaf must be a function that takes 2 params: index, column. The first is the integer row index of the listview, and the 2nd is the string column name. luaf should return a value that can be parsed into a .NET Color object (string color name, or integer value)\" );\r\nend );")]
|
||||
[LuaMethod("onqueryitemtext", "called during the text draw event of the tastudio listview. luaf must be a function that takes 2 params: index, column. The first is the integer row index of the listview, and the 2nd is the string column name. luaf should return a value that can be parsed into a .NET Color object (string color name, or integer value)")]
|
||||
public void OnQueryItemText(LuaFunction luaf)
|
||||
{
|
||||
|
@ -209,6 +249,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("tastudio.onqueryitemicon( function( currentindex, itemname )\r\n\tconsole.log( \"called during the icon draw event of the tastudio listview. luaf must be a function that takes 2 params: index, column. The first is the integer row index of the listview, and the 2nd is the string column name. luaf should return a value that can be parsed into a .NET Color object (string color name, or integer value)\" );\r\nend );")]
|
||||
[LuaMethod("onqueryitemicon", "called during the icon draw event of the tastudio listview. luaf must be a function that takes 2 params: index, column. The first is the integer row index of the listview, and the 2nd is the string column name. luaf should return a value that can be parsed into a .NET Color object (string color name, or integer value)")]
|
||||
public void OnQueryItemIcon(LuaFunction luaf)
|
||||
{
|
||||
|
@ -229,6 +270,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("tastudio.ongreenzoneinvalidated( function( currentindex, itemname )\r\n\tconsole.log( \"called whenever the greenzone is invalidated and returns the first frame that was invalidated\" );\r\nend );")]
|
||||
[LuaMethod("ongreenzoneinvalidated", "called whenever the greenzone is invalidated and returns the first frame that was invalidated")]
|
||||
public void OnGreenzoneInvalidated(LuaFunction luaf)
|
||||
{
|
||||
|
@ -241,6 +283,46 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("tastudio.ongreenzoneinvalidated( function( currentindex, itemname )\r\n\tconsole.log( \"called whenever the greenzone is invalidated and returns the first frame that was invalidated\" );\r\nend );")]
|
||||
[LuaMethod("onbranchload", "called whenever a branch is loaded. luaf must be a function that takes the integer branch index as a parameter")]
|
||||
public void OnBranchLoad(LuaFunction luaf)
|
||||
{
|
||||
if (Engaged())
|
||||
{
|
||||
Tastudio.BranchLoadedCallback = (int index) =>
|
||||
{
|
||||
luaf.Call(index);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("")]
|
||||
[LuaMethod("onbranchsave", "called whenever a branch is created or updated. luaf must be a function that takes the integer branch index as a parameter")]
|
||||
public void OnBranchSave(LuaFunction luaf)
|
||||
{
|
||||
if (Engaged())
|
||||
{
|
||||
Tastudio.BranchSavedCallback = (int index) =>
|
||||
{
|
||||
luaf.Call(index);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("")]
|
||||
[LuaMethod("onbranchremove", "called whenever a branch is removed. luaf must be a function that takes the integer branch index as a parameter")]
|
||||
public void OnBranchRemove(LuaFunction luaf)
|
||||
{
|
||||
if (Engaged())
|
||||
{
|
||||
Tastudio.BranchRemovedCallback = (int index) =>
|
||||
{
|
||||
luaf.Call(index);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("local nltasget = tastudio.getselection( );")]
|
||||
[LuaMethod("getselection", "gets the currently selected frames")]
|
||||
public LuaTable GetSelection()
|
||||
{
|
||||
|
@ -259,38 +341,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
return table;
|
||||
}
|
||||
|
||||
[LuaMethod("insertframes", "inserts the given number of blank frames at the given insertion frame")]
|
||||
public void InsertNumFrames(int insertionFrame, int numberOfFrames)
|
||||
{
|
||||
if (Engaged())
|
||||
{
|
||||
if (insertionFrame < Tastudio.CurrentTasMovie.InputLogLength)
|
||||
{
|
||||
Tastudio.InsertNumFrames(insertionFrame, numberOfFrames);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log(insertionFrame + " is out of range");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[LuaMethod("deleteframes", "deletes the given number of blank frames beginning at the given frame")]
|
||||
public void DeleteFrames(int beginningFrame, int numberOfFrames)
|
||||
{
|
||||
if (Engaged())
|
||||
{
|
||||
if (beginningFrame < Tastudio.CurrentTasMovie.InputLogLength)
|
||||
{
|
||||
Tastudio.DeleteFrames(beginningFrame, numberOfFrames);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log(beginningFrame + " is out of range");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class TastudioBranchInfo
|
||||
{
|
||||
public string Id { get; set; }
|
||||
|
@ -298,6 +348,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
public string Text { get; set; }
|
||||
}
|
||||
|
||||
[LuaMethodExample("local nltasget = tastudio.getbranches( );")]
|
||||
[LuaMethod("getbranches", "Returns a list of the current tastudio branches. Each entry will have the Id, Frame, and Text properties of the branch")]
|
||||
public LuaTable GetBranches()
|
||||
{
|
||||
|
@ -323,6 +374,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
|
||||
[LuaMethodExample("local nltasget = tastudio.getbranchinput( \"97021544-2454-4483-824f-47f75e7fcb6a\", 500 );")]
|
||||
[LuaMethod("getbranchinput", "Gets the controller state of the given frame with the given branch identifier")]
|
||||
public LuaTable GetBranchInput(string branchId, int frame)
|
||||
{
|
||||
|
@ -336,7 +388,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (frame < branch.InputLog.Count)
|
||||
{
|
||||
var input = branch.InputLog[frame];
|
||||
|
||||
|
||||
var adapter = new Bk2ControllerAdapter
|
||||
{
|
||||
Definition = Global.MovieSession.MovieControllerAdapter.Definition
|
||||
|
@ -359,5 +411,184 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
return table;
|
||||
}
|
||||
|
||||
[LuaMethodExample("")]
|
||||
[LuaMethod("submitinputchange", "")]
|
||||
public void SubmitInputChange(int frame, string button, bool value)
|
||||
{
|
||||
if (Engaged())
|
||||
{
|
||||
if (frame >= 0)
|
||||
{
|
||||
PendingChanges newChange = new PendingChanges();
|
||||
|
||||
if (frame < Tastudio.CurrentTasMovie.InputLogLength)
|
||||
{
|
||||
if (Tastudio.CurrentTasMovie.BoolIsPressed(frame, button) != value) //Check if the button state is not already in the state the user set in the lua script
|
||||
{
|
||||
newChange.type = LuaChangeTypes.InputChange;
|
||||
newChange.inputType = InputChangeTypes.Bool;
|
||||
newChange.frame = frame;
|
||||
newChange.button = button;
|
||||
newChange.valueBool = value;
|
||||
|
||||
changeList.Add(newChange);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Nothing to do here
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
newChange.type = LuaChangeTypes.InputChange;
|
||||
newChange.inputType = InputChangeTypes.Bool;
|
||||
newChange.frame = frame;
|
||||
newChange.button = button;
|
||||
newChange.valueBool = value;
|
||||
|
||||
changeList.Add(newChange);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("")]
|
||||
[LuaMethod("submitanalogchange", "")]
|
||||
public void SubmitAnalogChange(int frame, string button, float value)
|
||||
{
|
||||
if (Engaged())
|
||||
{
|
||||
if (frame >= 0)
|
||||
{
|
||||
PendingChanges newChange = new PendingChanges();
|
||||
|
||||
if (frame < Tastudio.CurrentTasMovie.InputLogLength)
|
||||
{
|
||||
if (Tastudio.CurrentTasMovie.GetFloatState(frame, button) != value) //Check if the button state is not already in the state the user set in the lua script
|
||||
{
|
||||
newChange.type = LuaChangeTypes.InputChange;
|
||||
newChange.inputType = InputChangeTypes.Float;
|
||||
newChange.frame = frame;
|
||||
newChange.button = button;
|
||||
newChange.valueFloat = value;
|
||||
|
||||
changeList.Add(newChange);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Nothing to do here
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
newChange.type = LuaChangeTypes.InputChange;
|
||||
newChange.inputType = InputChangeTypes.Float;
|
||||
newChange.frame = frame;
|
||||
newChange.button = button;
|
||||
newChange.valueFloat = value;
|
||||
|
||||
changeList.Add(newChange);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("")]
|
||||
[LuaMethod("submitinsertframes", "")]
|
||||
public void SubmitInsertFrames(int frame, int number)
|
||||
{
|
||||
if (Engaged())
|
||||
{
|
||||
if (frame >= 0 && frame < Tastudio.CurrentTasMovie.InputLogLength && number > 0)
|
||||
{
|
||||
PendingChanges newChange = new PendingChanges();
|
||||
|
||||
newChange.type = LuaChangeTypes.InsertFrames;
|
||||
newChange.frame = frame;
|
||||
newChange.number = number;
|
||||
|
||||
changeList.Add(newChange);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("")]
|
||||
[LuaMethod("submitdeleteframes", "")]
|
||||
public void SubmitDeleteFrames(int frame, int number)
|
||||
{
|
||||
if (Engaged())
|
||||
{
|
||||
if (frame >= 0 && frame < Tastudio.CurrentTasMovie.InputLogLength && number > 0)
|
||||
{
|
||||
PendingChanges newChange = new PendingChanges();
|
||||
|
||||
newChange.type = LuaChangeTypes.DeleteFrames;
|
||||
newChange.frame = frame;
|
||||
newChange.number = number;
|
||||
|
||||
changeList.Add(newChange);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("")]
|
||||
[LuaMethod("applyinputchanges", "")]
|
||||
public void ApplyInputChanges()
|
||||
{
|
||||
if (Engaged())
|
||||
{
|
||||
if (changeList.Count > 0)
|
||||
{
|
||||
int size = changeList.Count;
|
||||
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
switch (changeList[i].type)
|
||||
{
|
||||
case LuaChangeTypes.InputChange:
|
||||
switch (changeList[i].inputType)
|
||||
{
|
||||
case InputChangeTypes.Bool:
|
||||
Tastudio.CurrentTasMovie.SetBoolState(changeList[i].frame, changeList[i].button, changeList[i].valueBool);
|
||||
break;
|
||||
case InputChangeTypes.Float:
|
||||
Tastudio.CurrentTasMovie.SetFloatState(changeList[i].frame, changeList[i].button, changeList[i].valueFloat);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case LuaChangeTypes.InsertFrames:
|
||||
Tastudio.InsertNumFrames(changeList[i].frame, changeList[i].number);
|
||||
break;
|
||||
case LuaChangeTypes.DeleteFrames:
|
||||
Tastudio.DeleteFrames(changeList[i].frame, changeList[i].number);
|
||||
break;
|
||||
}
|
||||
}
|
||||
changeList.Clear();
|
||||
Tastudio.JumpToGreenzone();
|
||||
Tastudio.DoAutoRestore();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample("")]
|
||||
[LuaMethod("clearinputchanges", "")]
|
||||
public void ClearInputChanges()
|
||||
{
|
||||
if (Engaged())
|
||||
changeList.Clear();
|
||||
}
|
||||
|
||||
[LuaMethod("addcolumn", "")]
|
||||
public void AddColumn(string name, string text, int width)
|
||||
{
|
||||
if (Engaged())
|
||||
{
|
||||
Tastudio.AddColumn(name, text, width, InputRoll.RollColumn.InputType.Text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample(
|
||||
"LuaCanvas.setTitle( \"Title\" );")]
|
||||
[LuaMethod(
|
||||
"setTitle",
|
||||
"Sets the canvas window title")]
|
||||
|
@ -41,6 +43,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
Text = title;
|
||||
}
|
||||
|
||||
[LuaMethodExample(
|
||||
"LuaCanvas.setLocation( 16, 32 );")]
|
||||
[LuaMethod(
|
||||
"setLocation",
|
||||
"Sets the location of the canvas window")]
|
||||
|
@ -51,6 +55,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
Top = (int)y;
|
||||
}
|
||||
|
||||
[LuaMethodExample(
|
||||
"LuaCanvas.clear( 0x000000FF );")]
|
||||
[LuaMethod(
|
||||
"clear",
|
||||
"Clears the canvas")]
|
||||
|
@ -59,6 +65,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
luaPictureBox.Clear(color);
|
||||
}
|
||||
|
||||
[LuaMethodExample(
|
||||
"LuaCanvas.refresh( );")]
|
||||
[LuaMethod(
|
||||
"refresh",
|
||||
"Redraws the canvas")]
|
||||
|
@ -67,6 +75,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
luaPictureBox.Refresh();
|
||||
}
|
||||
|
||||
[LuaMethodExample(
|
||||
"LuaCanvas.setDefaultForegroundColor( 0x000000FF );")]
|
||||
[LuaMethod(
|
||||
"setDefaultForegroundColor",
|
||||
"Sets the default foreground color to use in drawing methods, white by default")]
|
||||
|
@ -75,6 +85,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
luaPictureBox.SetDefaultForegroundColor(color);
|
||||
}
|
||||
|
||||
[LuaMethodExample(
|
||||
"LuaCanvas.setDefaultBackgroundColor( 0x000000FF );")]
|
||||
[LuaMethod(
|
||||
"setDefaultBackgroundColor",
|
||||
"Sets the default background color to use in drawing methods, transparent by default")]
|
||||
|
@ -83,6 +95,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
luaPictureBox.SetDefaultBackgroundColor(color);
|
||||
}
|
||||
|
||||
[LuaMethodExample(
|
||||
"LuaCanvas.setDefaultTextBackground( 0x000000FF );")]
|
||||
[LuaMethod(
|
||||
"setDefaultTextBackground",
|
||||
"Sets the default backgroiund color to use in text drawing methods, half-transparent black by default")]
|
||||
|
@ -91,6 +105,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
luaPictureBox.SetDefaultTextBackground(color);
|
||||
}
|
||||
|
||||
[LuaMethodExample(
|
||||
"LuaCanvas.drawBezier( { { 5, 10 }, { 10, 10 }, { 10, 20 }, { 5, 20 } }, 0x000000FF );")]
|
||||
[LuaMethod(
|
||||
"drawBezier",
|
||||
"Draws a Bezier curve using the table of coordinates provided in the given color")]
|
||||
|
@ -107,6 +123,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample(
|
||||
"LuaCanvas.drawBox( 16, 32, 162, 322, 0x007F00FF, 0x7F7F7FFF );")]
|
||||
[LuaMethod(
|
||||
"drawBox",
|
||||
"Draws a rectangle on screen from x1/y1 to x2/y2. Same as drawRectangle except it receives two points intead of a point and width/height")]
|
||||
|
@ -123,6 +141,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample(
|
||||
"LuaCanvas.drawEllipse( 16, 32, 77, 99, 0x007F00FF, 0x7F7F7FFF );")]
|
||||
[LuaMethod(
|
||||
"drawEllipse",
|
||||
"Draws an ellipse at the given coordinates and the given width and height. Line is the color of the ellipse. Background is the optional fill color")]
|
||||
|
@ -139,6 +159,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample(
|
||||
"LuaCanvas.drawIcon( \"C:\\icon.ico\", 16, 32, 18, 24 );")]
|
||||
[LuaMethod(
|
||||
"drawIcon",
|
||||
"draws an Icon (.ico) file from the given path at the given coordinate. width and height are optional. If specified, it will resize the image accordingly")]
|
||||
|
@ -155,6 +177,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample(
|
||||
"LuaCanvas.drawImage( \"C:\\image.bmp\", 16, 32, 18, 24, false );")]
|
||||
[LuaMethod(
|
||||
"drawImage",
|
||||
"draws an image file from the given path at the given coordinate. width and height are optional. If specified, it will resize the image accordingly")]
|
||||
|
@ -169,6 +193,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
luaPictureBox.DrawImage(path, x, y, width, height, cache);
|
||||
}
|
||||
|
||||
[LuaMethodExample(
|
||||
"LuaCanvas.clearImageCache( );")]
|
||||
[LuaMethod(
|
||||
"clearImageCache",
|
||||
"clears the image cache that is built up by using gui.drawImage, also releases the file handle for cached images")]
|
||||
|
@ -177,6 +203,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
luaPictureBox.ClearImageCache();
|
||||
}
|
||||
|
||||
[LuaMethodExample(
|
||||
"LuaCanvas.drawImageRegion( \"C:\\image.png\", 11, 22, 33, 44, 21, 43, 34, 45 );")]
|
||||
[LuaMethod(
|
||||
"drawImageRegion",
|
||||
"draws a given region of an image file from the given path at the given coordinate, and optionally with the given size")]
|
||||
|
@ -191,6 +219,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
luaPictureBox.DrawImageRegion(path, source_x, source_y, source_width, source_height, dest_x, dest_y, dest_width, dest_height);
|
||||
}
|
||||
|
||||
[LuaMethodExample(
|
||||
"LuaCanvas.drawLine( 161, 321, 162, 322, 0xFFFFFFFF );")]
|
||||
[LuaMethod(
|
||||
"drawLine",
|
||||
"Draws a line from the first coordinate pair to the 2nd. Color is optional (if not specified it will be drawn black)")]
|
||||
|
@ -199,6 +229,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
luaPictureBox.DrawLine(x1, y1, x2, y2, color);
|
||||
}
|
||||
|
||||
[LuaMethodExample(
|
||||
"LuaCanvas.drawAxis( 16, 32, int size, 0xFFFFFFFF );")]
|
||||
[LuaMethod(
|
||||
"drawAxis",
|
||||
"Draws an axis of the specified size at the coordinate pair.)")]
|
||||
|
@ -207,6 +239,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
luaPictureBox.DrawAxis(x, y, size, color);
|
||||
}
|
||||
|
||||
[LuaMethodExample(
|
||||
"LuaCanvas.drawArc( 16, 32, 77, 99, 180, 90, 0x007F00FF );")]
|
||||
[LuaMethod(
|
||||
"drawArc",
|
||||
"draws a Arc shape at the given coordinates and the given width and height"
|
||||
|
@ -216,6 +250,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
luaPictureBox.DrawArc(x, y, width, height, startangle, sweepangle, line);
|
||||
}
|
||||
|
||||
[LuaMethodExample(
|
||||
"LuaCanvas.drawPie( 16, 32, 77, 99, 180, 90, 0x007F00FF, 0x7F7F7FFF );")]
|
||||
[LuaMethod(
|
||||
"drawPie",
|
||||
"draws a Pie shape at the given coordinates and the given width and height")]
|
||||
|
@ -232,6 +268,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
luaPictureBox.DrawPie(x, y, width, height, startangle, sweepangle, line, background);
|
||||
}
|
||||
|
||||
[LuaMethodExample(
|
||||
"LuaCanvas.drawPixel( 16, 32, 0xFFFFFFFF );")]
|
||||
[LuaMethod(
|
||||
"drawPixel",
|
||||
"Draws a single pixel at the given coordinates in the given color. Color is optional (if not specified it will be drawn black)")]
|
||||
|
@ -248,6 +286,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
[LuaMethodExample(
|
||||
"LuaCanvas.drawPolygon( { 10, 0x007F00FF, 0x7F7F7FFF );")]
|
||||
[LuaMethod(
|
||||
"drawPolygon",
|
||||
"Draws a polygon using the table of coordinates specified in points. This should be a table of tables(each of size 2). Line is the color of the polygon. Background is the optional fill color")]
|
||||
|
@ -265,6 +305,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
|
||||
[LuaMethodExample(
|
||||
"LuaCanvas.drawRectangle( 16, 32, 77, 99, 0x007F00FF, 0x7F7F7FFF );")]
|
||||
[LuaMethod(
|
||||
"drawRectangle",
|
||||
"Draws a rectangle at the given coordinate and the given width and height. Line is the color of the box. Background is the optional fill color")]
|
||||
|
@ -273,6 +315,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
luaPictureBox.DrawRectangle(x, y, width, height, line, background);
|
||||
}
|
||||
|
||||
[LuaMethodExample(
|
||||
"LuaCanvas.drawString( 16, 32, \"Some message\", 0x7F0000FF, 0x00007FFF, 8, \"Arial Narrow\", \"bold\", \"center\", \"middle\" );")]
|
||||
[LuaMethod(
|
||||
"drawString",
|
||||
"Alias of DrawText()")]
|
||||
|
@ -291,6 +335,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
luaPictureBox.DrawText(x, y, message, forecolor, backcolor, fontsize, fontfamily, fontstyle, horizalign, vertalign);
|
||||
}
|
||||
|
||||
[LuaMethodExample(
|
||||
"LuaCanvas.drawText( 16, 32, \"Some message\", 0x7F0000FF, 0x00007FFF, 8, \"Arial Narrow\", \"bold\", \"center\", \"middle\" );")]
|
||||
[LuaMethod(
|
||||
"drawText",
|
||||
"Draws the given message at the given x,y coordinates and the given color. The default color is white. A fontfamily can be specified and is monospace generic if none is specified (font family options are the same as the .NET FontFamily class). The fontsize default is 12. The default font style is regular. Font style options are regular, bold, italic, strikethrough, underline. Horizontal alignment options are left (default), center, or right. Vertical alignment options are bottom (default), middle, or top. Alignment options specify which ends of the text will be drawn at the x and y coordinates.")]
|
||||
|
@ -311,6 +357,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
|
||||
// It'd be great if these were simplified into 1 function, but I cannot figure out how to return a LuaTable from this class
|
||||
[LuaMethodExample(
|
||||
"local inLuaget = LuaCanvas.getMouseX( );")]
|
||||
[LuaMethod(
|
||||
"getMouseX",
|
||||
"Returns an integer representation of the mouse X coordinate relative to the canvas window.")]
|
||||
|
@ -320,6 +368,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
return position.X;
|
||||
}
|
||||
|
||||
[LuaMethodExample(
|
||||
"local inLuaget = LuaCanvas.getMouseY( );")]
|
||||
[LuaMethod(
|
||||
"getMouseY",
|
||||
"Returns an integer representation of the mouse Y coordinate relative to the canvas window.")]
|
||||
|
|
|
@ -82,6 +82,14 @@
|
|||
this.ToWikiMarkupButton.Text = "Wiki markup to Clipboard";
|
||||
this.ToWikiMarkupButton.UseVisualStyleBackColor = true;
|
||||
this.ToWikiMarkupButton.Click += new System.EventHandler(this.ToWikiMarkupButton_Click);
|
||||
//
|
||||
// CopyMenu
|
||||
//
|
||||
this.CopyMenu = new System.Windows.Forms.ContextMenu(
|
||||
new System.Windows.Forms.MenuItem[] {
|
||||
new System.Windows.Forms.MenuItem("Copy")
|
||||
});
|
||||
this.CopyMenu.MenuItems[0].Click += new System.EventHandler(this.FunctionView_Copy);
|
||||
//
|
||||
// FunctionView
|
||||
//
|
||||
|
@ -109,6 +117,7 @@
|
|||
this.FunctionView.VirtualMode = true;
|
||||
this.FunctionView.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.FunctionView_ColumnClick);
|
||||
this.FunctionView.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FunctionView_KeyDown);
|
||||
this.FunctionView.ContextMenu = this.CopyMenu;
|
||||
//
|
||||
// LibraryReturn
|
||||
//
|
||||
|
@ -170,5 +179,6 @@
|
|||
private System.Windows.Forms.TextBox FilterBox;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Button ToWikiMarkupButton;
|
||||
private System.Windows.Forms.ContextMenu CopyMenu;
|
||||
}
|
||||
}
|
|
@ -6,6 +6,7 @@ using System.Text;
|
|||
using System.Windows.Forms;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Common;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
|
@ -182,6 +183,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
var indexes = FunctionView.SelectedIndices;
|
||||
|
||||
//TODO - duplicated code with FunctionView_Copy
|
||||
//also -- this list is more compact (the examples would fill space)
|
||||
//it isn't clear whether we should copy the examples here. So maybe this should stay distinct (and more compact?)
|
||||
|
||||
if (indexes.Count > 0)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
|
@ -193,13 +198,26 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
if (sb.Length > 0)
|
||||
{
|
||||
Clipboard.SetDataObject(sb.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//FREVBHFYL?
|
||||
private void FunctionView_Copy(object sender, EventArgs e)
|
||||
{
|
||||
var itm = _filteredList[FunctionView.selectedItem];
|
||||
var sb = new StringBuilder($"//{itm.Library}.{itm.Name}{itm.ParameterList}"); //comment style not an accident: the 'declaration' is not legal lua, so use of -- to comment it shouldn't suggest it. right?
|
||||
if (itm.Example != null)
|
||||
{
|
||||
sb.AppendLine();
|
||||
sb.Append(itm.Example);
|
||||
}
|
||||
|
||||
if (sb.Length > 0)
|
||||
Clipboard.SetText(sb.ToString());
|
||||
}
|
||||
|
||||
private void UpdateList()
|
||||
{
|
||||
GenerateFilteredList();
|
||||
|
|
|
@ -295,7 +295,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
return PathManager.MakeAbsolutePath(Path.Combine(
|
||||
Global.Config.PathEntries["Global", "Macros"].Path,
|
||||
Global.Game.Name), null);
|
||||
PathManager.FilesystemSafeName(Global.Game)), null);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -28,6 +28,27 @@ namespace BizHawk.Client.EmuHawk
|
|||
Load, Update, Text, Remove, None
|
||||
}
|
||||
|
||||
public Action<int> LoadedCallback { get; set; }
|
||||
|
||||
private void CallLoadedCallback(int index)
|
||||
{
|
||||
LoadedCallback?.Invoke(index);
|
||||
}
|
||||
|
||||
public Action<int> SavedCallback { get; set; }
|
||||
|
||||
private void CallSavedCallback(int index)
|
||||
{
|
||||
SavedCallback?.Invoke(index);
|
||||
}
|
||||
|
||||
public Action<int> RemovedCallback { get; set; }
|
||||
|
||||
private void CallRemovedCallback(int index)
|
||||
{
|
||||
RemovedCallback?.Invoke(index);
|
||||
}
|
||||
|
||||
public TAStudio Tastudio { get; set; }
|
||||
|
||||
public int HoverInterval
|
||||
|
@ -135,6 +156,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
Movie.AddBranch(branch);
|
||||
BranchView.RowCount = Movie.BranchCount;
|
||||
Movie.CurrentBranch = Movie.BranchCount - 1;
|
||||
BranchView.ScrollToIndex(Movie.CurrentBranch);
|
||||
BranchView.Refresh();
|
||||
Tastudio.RefreshDialog();
|
||||
}
|
||||
|
@ -209,6 +231,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
private void AddBranchToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Branch();
|
||||
CallSavedCallback(Tastudio.CurrentTasMovie.BranchCount - 1);
|
||||
GlobalWin.OSD.AddMessage("Added branch " + Movie.CurrentBranch.ToString());
|
||||
}
|
||||
|
||||
|
@ -216,6 +239,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
Branch();
|
||||
EditBranchTextPopUp(Movie.CurrentBranch);
|
||||
CallSavedCallback(Tastudio.CurrentTasMovie.BranchCount - 1);
|
||||
GlobalWin.OSD.AddMessage("Added branch " + Movie.CurrentBranch.ToString());
|
||||
}
|
||||
|
||||
|
@ -236,6 +260,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
_branchUndo = BranchUndo.Load;
|
||||
|
||||
LoadSelectedBranch();
|
||||
CallLoadedCallback(BranchView.SelectedRows.First());
|
||||
}
|
||||
|
||||
private void UpdateBranchToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
|
@ -251,6 +276,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
_branchUndo = BranchUndo.Update;
|
||||
|
||||
UpdateBranch(SelectedBranch);
|
||||
CallSavedCallback(Movie.CurrentBranch);
|
||||
GlobalWin.OSD.AddMessage("Saved branch " + Movie.CurrentBranch);
|
||||
}
|
||||
}
|
||||
|
@ -315,6 +341,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
BranchView.SelectRow(Movie.BranchCount - 1, true);
|
||||
}
|
||||
|
||||
CallRemovedCallback(index);
|
||||
Tastudio.RefreshDialog();
|
||||
GlobalWin.OSD.AddMessage("Removed branch " + index.ToString());
|
||||
}
|
||||
|
@ -325,11 +352,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (_branchUndo == BranchUndo.Load)
|
||||
{
|
||||
LoadBranch(_backupBranch);
|
||||
CallLoadedCallback(Tastudio.CurrentTasMovie.Branches.IndexOf(_backupBranch));
|
||||
GlobalWin.OSD.AddMessage("Branch Load canceled");
|
||||
}
|
||||
else if (_branchUndo == BranchUndo.Update)
|
||||
{
|
||||
Movie.UpdateBranch(Movie.GetBranch(_backupBranch.UniqueIdentifier), _backupBranch);
|
||||
CallSavedCallback(Tastudio.CurrentTasMovie.Branches.IndexOf(_backupBranch));
|
||||
GlobalWin.OSD.AddMessage("Branch Update canceled");
|
||||
}
|
||||
else if (_branchUndo == BranchUndo.Text)
|
||||
|
@ -341,6 +370,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
Movie.AddBranch(_backupBranch);
|
||||
BranchView.RowCount = Movie.BranchCount;
|
||||
CallSavedCallback(Tastudio.CurrentTasMovie.Branches.IndexOf(_backupBranch));
|
||||
GlobalWin.OSD.AddMessage("Branch Removal canceled");
|
||||
}
|
||||
|
||||
|
@ -610,9 +640,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
TasBranch branch = GetBranch(BranchView.CurrentCell.RowIndex.Value);
|
||||
Point location = Location;
|
||||
location.Offset(-Screenshot.Width, 0);
|
||||
int width = Tastudio.VideoProvider.BufferWidth;
|
||||
int height = Tastudio.VideoProvider.BufferHeight;
|
||||
int width = branch.OSDFrameBuffer.Width;
|
||||
int height = branch.OSDFrameBuffer.Height;
|
||||
location.Offset(-width, 0);
|
||||
|
||||
Screenshot.UpdateValues(branch, PointToScreen(location), width, height,
|
||||
(int)Graphics.FromHwnd(this.Handle).MeasureString(
|
||||
|
|
|
@ -48,28 +48,36 @@ namespace BizHawk.Client.EmuHawk
|
|||
this.DiskCapacityNumeric = new System.Windows.Forms.NumericUpDown();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.SaveCapacityNumeric = new System.Windows.Forms.NumericUpDown();
|
||||
this.FileCapacityNumeric = new System.Windows.Forms.NumericUpDown();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.label8 = new System.Windows.Forms.Label();
|
||||
this.label9 = new System.Windows.Forms.Label();
|
||||
this.NumSaveStatesLabel = new System.Windows.Forms.Label();
|
||||
this.BranchStatesInTasproj = new System.Windows.Forms.CheckBox();
|
||||
this.EraseBranchStatesFirst = new System.Windows.Forms.CheckBox();
|
||||
this.StateGap = new System.Windows.Forms.NumericUpDown();
|
||||
this.FileStateGapNumeric = new System.Windows.Forms.NumericUpDown();
|
||||
this.label10 = new System.Windows.Forms.Label();
|
||||
this.label11 = new System.Windows.Forms.Label();
|
||||
this.NumFramesLabel = new System.Windows.Forms.Label();
|
||||
this.FileNumFramesLabel = new System.Windows.Forms.Label();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.label14 = new System.Windows.Forms.Label();
|
||||
this.MemFramesLabel = new System.Windows.Forms.Label();
|
||||
this.label13 = new System.Windows.Forms.Label();
|
||||
this.MemStateGapDividerNumeric = new System.Windows.Forms.NumericUpDown();
|
||||
this.label12 = new System.Windows.Forms.Label();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
((System.ComponentModel.ISupportInitialize)(this.MemCapacityNumeric)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.DiskCapacityNumeric)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.SaveCapacityNumeric)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.StateGap)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.FileCapacityNumeric)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.FileStateGapNumeric)).BeginInit();
|
||||
this.groupBox1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.MemStateGapDividerNumeric)).BeginInit();
|
||||
this.groupBox2.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// CancelBtn
|
||||
//
|
||||
this.CancelBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.CancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.CancelBtn.Location = new System.Drawing.Point(217, 220);
|
||||
this.CancelBtn.Location = new System.Drawing.Point(242, 225);
|
||||
this.CancelBtn.Name = "CancelBtn";
|
||||
this.CancelBtn.Size = new System.Drawing.Size(60, 23);
|
||||
this.CancelBtn.TabIndex = 0;
|
||||
|
@ -80,7 +88,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
// OkBtn
|
||||
//
|
||||
this.OkBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.OkBtn.Location = new System.Drawing.Point(151, 220);
|
||||
this.OkBtn.Location = new System.Drawing.Point(176, 225);
|
||||
this.OkBtn.Name = "OkBtn";
|
||||
this.OkBtn.Size = new System.Drawing.Size(60, 23);
|
||||
this.OkBtn.TabIndex = 1;
|
||||
|
@ -90,7 +98,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
//
|
||||
// MemCapacityNumeric
|
||||
//
|
||||
this.MemCapacityNumeric.Location = new System.Drawing.Point(15, 49);
|
||||
this.MemCapacityNumeric.Location = new System.Drawing.Point(12, 36);
|
||||
this.MemCapacityNumeric.Maximum = new decimal(new int[] {
|
||||
1024,
|
||||
0,
|
||||
|
@ -114,20 +122,20 @@ namespace BizHawk.Client.EmuHawk
|
|||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(70, 52);
|
||||
this.label1.Location = new System.Drawing.Point(73, 39);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(21, 13);
|
||||
this.label1.Size = new System.Drawing.Size(23, 13);
|
||||
this.label1.TabIndex = 4;
|
||||
this.label1.Text = "mb";
|
||||
this.label1.Text = "MB";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(12, 32);
|
||||
this.label2.Location = new System.Drawing.Point(9, 19);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(88, 13);
|
||||
this.label2.Size = new System.Drawing.Size(48, 13);
|
||||
this.label2.TabIndex = 5;
|
||||
this.label2.Text = "Memory Capacity";
|
||||
this.label2.Text = "Capacity";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
|
@ -150,7 +158,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(12, 136);
|
||||
this.label4.Location = new System.Drawing.Point(160, 9);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(84, 13);
|
||||
this.label4.TabIndex = 8;
|
||||
|
@ -159,17 +167,19 @@ namespace BizHawk.Client.EmuHawk
|
|||
// NumStatesLabel
|
||||
//
|
||||
this.NumStatesLabel.AutoSize = true;
|
||||
this.NumStatesLabel.Location = new System.Drawing.Point(99, 136);
|
||||
this.NumStatesLabel.Location = new System.Drawing.Point(250, 9);
|
||||
this.NumStatesLabel.Name = "NumStatesLabel";
|
||||
this.NumStatesLabel.Size = new System.Drawing.Size(25, 13);
|
||||
this.NumStatesLabel.Size = new System.Drawing.Size(13, 13);
|
||||
this.NumStatesLabel.TabIndex = 9;
|
||||
this.NumStatesLabel.Text = "1kb";
|
||||
this.NumStatesLabel.Text = "1";
|
||||
//
|
||||
// DiskCapacityNumeric
|
||||
//
|
||||
this.DiskCapacityNumeric.Location = new System.Drawing.Point(15, 113);
|
||||
this.DiskCapacityNumeric.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.DiskCapacityNumeric.Enabled = false;
|
||||
this.DiskCapacityNumeric.Location = new System.Drawing.Point(24, 215);
|
||||
this.DiskCapacityNumeric.Maximum = new decimal(new int[] {
|
||||
65536,
|
||||
16384,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
|
@ -182,7 +192,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
this.DiskCapacityNumeric.Size = new System.Drawing.Size(55, 20);
|
||||
this.DiskCapacityNumeric.TabIndex = 3;
|
||||
this.DiskCapacityNumeric.Value = new decimal(new int[] {
|
||||
512,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
|
@ -190,62 +200,66 @@ namespace BizHawk.Client.EmuHawk
|
|||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(70, 116);
|
||||
this.label5.Enabled = false;
|
||||
this.label5.Location = new System.Drawing.Point(79, 218);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(21, 13);
|
||||
this.label5.Size = new System.Drawing.Size(23, 13);
|
||||
this.label5.TabIndex = 4;
|
||||
this.label5.Text = "mb";
|
||||
this.label5.Text = "MB";
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Location = new System.Drawing.Point(12, 96);
|
||||
this.label6.Enabled = false;
|
||||
this.label6.Location = new System.Drawing.Point(21, 198);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(72, 13);
|
||||
this.label6.TabIndex = 5;
|
||||
this.label6.Text = "Disk Capacity";
|
||||
//
|
||||
// SaveCapacityNumeric
|
||||
// FileCapacityNumeric
|
||||
//
|
||||
this.SaveCapacityNumeric.Location = new System.Drawing.Point(150, 49);
|
||||
this.SaveCapacityNumeric.Maximum = new decimal(new int[] {
|
||||
this.FileCapacityNumeric.Location = new System.Drawing.Point(12, 36);
|
||||
this.FileCapacityNumeric.Maximum = new decimal(new int[] {
|
||||
65536,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.SaveCapacityNumeric.Name = "SaveCapacityNumeric";
|
||||
this.SaveCapacityNumeric.Size = new System.Drawing.Size(55, 20);
|
||||
this.SaveCapacityNumeric.TabIndex = 3;
|
||||
this.SaveCapacityNumeric.Value = new decimal(new int[] {
|
||||
this.FileCapacityNumeric.Name = "FileCapacityNumeric";
|
||||
this.FileCapacityNumeric.Size = new System.Drawing.Size(55, 20);
|
||||
this.FileCapacityNumeric.TabIndex = 3;
|
||||
this.FileCapacityNumeric.Value = new decimal(new int[] {
|
||||
512,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.SaveCapacityNumeric.ValueChanged += new System.EventHandler(this.SaveCapacityNumeric_ValueChanged);
|
||||
this.FileCapacityNumeric.ValueChanged += new System.EventHandler(this.SaveCapacityNumeric_ValueChanged);
|
||||
//
|
||||
// label7
|
||||
//
|
||||
this.label7.AutoSize = true;
|
||||
this.label7.Location = new System.Drawing.Point(205, 52);
|
||||
this.label7.Location = new System.Drawing.Point(73, 39);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Size = new System.Drawing.Size(21, 13);
|
||||
this.label7.Size = new System.Drawing.Size(23, 13);
|
||||
this.label7.TabIndex = 4;
|
||||
this.label7.Text = "mb";
|
||||
this.label7.Text = "MB";
|
||||
//
|
||||
// label8
|
||||
//
|
||||
this.label8.AutoSize = true;
|
||||
this.label8.Location = new System.Drawing.Point(147, 32);
|
||||
this.label8.Location = new System.Drawing.Point(9, 19);
|
||||
this.label8.Name = "label8";
|
||||
this.label8.Size = new System.Drawing.Size(112, 13);
|
||||
this.label8.Size = new System.Drawing.Size(48, 13);
|
||||
this.label8.TabIndex = 5;
|
||||
this.label8.Text = "Project Save Capacity";
|
||||
this.label8.Text = "Capacity";
|
||||
//
|
||||
// label9
|
||||
//
|
||||
this.label9.AutoSize = true;
|
||||
this.label9.Location = new System.Drawing.Point(147, 72);
|
||||
this.label9.Location = new System.Drawing.Point(9, 59);
|
||||
this.label9.Name = "label9";
|
||||
this.label9.Size = new System.Drawing.Size(84, 13);
|
||||
this.label9.TabIndex = 8;
|
||||
|
@ -254,82 +268,150 @@ namespace BizHawk.Client.EmuHawk
|
|||
// NumSaveStatesLabel
|
||||
//
|
||||
this.NumSaveStatesLabel.AutoSize = true;
|
||||
this.NumSaveStatesLabel.Location = new System.Drawing.Point(234, 72);
|
||||
this.NumSaveStatesLabel.Location = new System.Drawing.Point(96, 59);
|
||||
this.NumSaveStatesLabel.Name = "NumSaveStatesLabel";
|
||||
this.NumSaveStatesLabel.Size = new System.Drawing.Size(25, 13);
|
||||
this.NumSaveStatesLabel.Size = new System.Drawing.Size(13, 13);
|
||||
this.NumSaveStatesLabel.TabIndex = 9;
|
||||
this.NumSaveStatesLabel.Text = "1kb";
|
||||
this.NumSaveStatesLabel.Text = "1";
|
||||
//
|
||||
// BranchStatesInTasproj
|
||||
// FileStateGapNumeric
|
||||
//
|
||||
this.BranchStatesInTasproj.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.BranchStatesInTasproj.AutoSize = true;
|
||||
this.BranchStatesInTasproj.Location = new System.Drawing.Point(15, 165);
|
||||
this.BranchStatesInTasproj.Name = "BranchStatesInTasproj";
|
||||
this.BranchStatesInTasproj.Size = new System.Drawing.Size(158, 17);
|
||||
this.BranchStatesInTasproj.TabIndex = 10;
|
||||
this.BranchStatesInTasproj.Text = "Put branch states to .tasproj";
|
||||
this.BranchStatesInTasproj.UseVisualStyleBackColor = true;
|
||||
this.BranchStatesInTasproj.CheckedChanged += new System.EventHandler(this.BranchStatesInTasproj_CheckedChanged);
|
||||
//
|
||||
// EraseBranchStatesFirst
|
||||
//
|
||||
this.EraseBranchStatesFirst.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.EraseBranchStatesFirst.AutoSize = true;
|
||||
this.EraseBranchStatesFirst.Checked = true;
|
||||
this.EraseBranchStatesFirst.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.EraseBranchStatesFirst.Location = new System.Drawing.Point(15, 190);
|
||||
this.EraseBranchStatesFirst.Name = "EraseBranchStatesFirst";
|
||||
this.EraseBranchStatesFirst.Size = new System.Drawing.Size(139, 17);
|
||||
this.EraseBranchStatesFirst.TabIndex = 11;
|
||||
this.EraseBranchStatesFirst.Text = "Erase branch states first";
|
||||
this.EraseBranchStatesFirst.UseVisualStyleBackColor = true;
|
||||
this.EraseBranchStatesFirst.CheckedChanged += new System.EventHandler(this.EraseBranchStatesFIrst_CheckedChanged);
|
||||
//
|
||||
// StateGap
|
||||
//
|
||||
this.StateGap.Location = new System.Drawing.Point(151, 112);
|
||||
this.StateGap.Maximum = new decimal(new int[] {
|
||||
this.FileStateGapNumeric.Location = new System.Drawing.Point(12, 100);
|
||||
this.FileStateGapNumeric.Maximum = new decimal(new int[] {
|
||||
8,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.StateGap.Name = "StateGap";
|
||||
this.StateGap.Size = new System.Drawing.Size(55, 20);
|
||||
this.StateGap.TabIndex = 12;
|
||||
this.StateGap.Value = new decimal(new int[] {
|
||||
this.FileStateGapNumeric.Name = "FileStateGapNumeric";
|
||||
this.FileStateGapNumeric.Size = new System.Drawing.Size(55, 20);
|
||||
this.FileStateGapNumeric.TabIndex = 12;
|
||||
this.FileStateGapNumeric.Value = new decimal(new int[] {
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.StateGap.ValueChanged += new System.EventHandler(this.StateGap_ValueChanged);
|
||||
this.FileStateGapNumeric.ValueChanged += new System.EventHandler(this.FileStateGap_ValueChanged);
|
||||
//
|
||||
// label10
|
||||
//
|
||||
this.label10.AutoSize = true;
|
||||
this.label10.Location = new System.Drawing.Point(148, 96);
|
||||
this.label10.Location = new System.Drawing.Point(9, 84);
|
||||
this.label10.Name = "label10";
|
||||
this.label10.Size = new System.Drawing.Size(91, 13);
|
||||
this.label10.Size = new System.Drawing.Size(55, 13);
|
||||
this.label10.TabIndex = 13;
|
||||
this.label10.Text = "Project State Gap";
|
||||
this.label10.Text = "State Gap";
|
||||
//
|
||||
// label11
|
||||
//
|
||||
this.label11.AutoSize = true;
|
||||
this.label11.Location = new System.Drawing.Point(147, 135);
|
||||
this.label11.Location = new System.Drawing.Point(8, 123);
|
||||
this.label11.Name = "label11";
|
||||
this.label11.Size = new System.Drawing.Size(61, 13);
|
||||
this.label11.TabIndex = 14;
|
||||
this.label11.Text = "State every";
|
||||
//
|
||||
// NumFramesLabel
|
||||
// FileNumFramesLabel
|
||||
//
|
||||
this.NumFramesLabel.AutoSize = true;
|
||||
this.NumFramesLabel.Location = new System.Drawing.Point(204, 135);
|
||||
this.NumFramesLabel.Name = "NumFramesLabel";
|
||||
this.NumFramesLabel.Size = new System.Drawing.Size(47, 13);
|
||||
this.NumFramesLabel.TabIndex = 15;
|
||||
this.NumFramesLabel.Text = "0 frames";
|
||||
this.FileNumFramesLabel.AutoSize = true;
|
||||
this.FileNumFramesLabel.Location = new System.Drawing.Point(65, 123);
|
||||
this.FileNumFramesLabel.Name = "FileNumFramesLabel";
|
||||
this.FileNumFramesLabel.Size = new System.Drawing.Size(47, 13);
|
||||
this.FileNumFramesLabel.TabIndex = 15;
|
||||
this.FileNumFramesLabel.Text = "0 frames";
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.label14);
|
||||
this.groupBox1.Controls.Add(this.MemFramesLabel);
|
||||
this.groupBox1.Controls.Add(this.label13);
|
||||
this.groupBox1.Controls.Add(this.MemStateGapDividerNumeric);
|
||||
this.groupBox1.Controls.Add(this.label12);
|
||||
this.groupBox1.Controls.Add(this.label2);
|
||||
this.groupBox1.Controls.Add(this.MemCapacityNumeric);
|
||||
this.groupBox1.Controls.Add(this.label1);
|
||||
this.groupBox1.Location = new System.Drawing.Point(12, 34);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(143, 147);
|
||||
this.groupBox1.TabIndex = 16;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Memory Usage";
|
||||
//
|
||||
// label14
|
||||
//
|
||||
this.label14.AutoSize = true;
|
||||
this.label14.Location = new System.Drawing.Point(73, 102);
|
||||
this.label14.Name = "label14";
|
||||
this.label14.Size = new System.Drawing.Size(21, 13);
|
||||
this.label14.TabIndex = 17;
|
||||
this.label14.Text = "KB";
|
||||
//
|
||||
// MemFramesLabel
|
||||
//
|
||||
this.MemFramesLabel.AutoSize = true;
|
||||
this.MemFramesLabel.Location = new System.Drawing.Point(66, 123);
|
||||
this.MemFramesLabel.Name = "MemFramesLabel";
|
||||
this.MemFramesLabel.Size = new System.Drawing.Size(47, 13);
|
||||
this.MemFramesLabel.TabIndex = 16;
|
||||
this.MemFramesLabel.Text = "0 frames";
|
||||
//
|
||||
// label13
|
||||
//
|
||||
this.label13.AutoSize = true;
|
||||
this.label13.Location = new System.Drawing.Point(9, 123);
|
||||
this.label13.Name = "label13";
|
||||
this.label13.Size = new System.Drawing.Size(61, 13);
|
||||
this.label13.TabIndex = 15;
|
||||
this.label13.Text = "State every";
|
||||
//
|
||||
// MemStateGapDividerNumeric
|
||||
//
|
||||
this.MemStateGapDividerNumeric.Location = new System.Drawing.Point(12, 100);
|
||||
this.MemStateGapDividerNumeric.Maximum = new decimal(new int[] {
|
||||
1024,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.MemStateGapDividerNumeric.Minimum = new decimal(new int[] {
|
||||
64,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.MemStateGapDividerNumeric.Name = "MemStateGapDividerNumeric";
|
||||
this.MemStateGapDividerNumeric.Size = new System.Drawing.Size(55, 20);
|
||||
this.MemStateGapDividerNumeric.TabIndex = 7;
|
||||
this.MemStateGapDividerNumeric.Value = new decimal(new int[] {
|
||||
65,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.MemStateGapDividerNumeric.ValueChanged += new System.EventHandler(this.MemStateGapDivider_ValueChanged);
|
||||
//
|
||||
// label12
|
||||
//
|
||||
this.label12.AutoSize = true;
|
||||
this.label12.Location = new System.Drawing.Point(9, 84);
|
||||
this.label12.Name = "label12";
|
||||
this.label12.Size = new System.Drawing.Size(91, 13);
|
||||
this.label12.TabIndex = 6;
|
||||
this.label12.Text = "State Gap Divider";
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Controls.Add(this.label8);
|
||||
this.groupBox2.Controls.Add(this.FileCapacityNumeric);
|
||||
this.groupBox2.Controls.Add(this.FileNumFramesLabel);
|
||||
this.groupBox2.Controls.Add(this.label7);
|
||||
this.groupBox2.Controls.Add(this.label11);
|
||||
this.groupBox2.Controls.Add(this.label9);
|
||||
this.groupBox2.Controls.Add(this.label10);
|
||||
this.groupBox2.Controls.Add(this.NumSaveStatesLabel);
|
||||
this.groupBox2.Controls.Add(this.FileStateGapNumeric);
|
||||
this.groupBox2.Location = new System.Drawing.Point(163, 34);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Size = new System.Drawing.Size(138, 147);
|
||||
this.groupBox2.TabIndex = 17;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "Project File";
|
||||
//
|
||||
// StateHistorySettingsForm
|
||||
//
|
||||
|
@ -337,28 +419,16 @@ namespace BizHawk.Client.EmuHawk
|
|||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.CancelButton = this.CancelBtn;
|
||||
this.ClientSize = new System.Drawing.Size(289, 255);
|
||||
this.Controls.Add(this.NumFramesLabel);
|
||||
this.Controls.Add(this.label11);
|
||||
this.Controls.Add(this.label10);
|
||||
this.Controls.Add(this.StateGap);
|
||||
this.Controls.Add(this.EraseBranchStatesFirst);
|
||||
this.Controls.Add(this.BranchStatesInTasproj);
|
||||
this.Controls.Add(this.NumSaveStatesLabel);
|
||||
this.Controls.Add(this.NumStatesLabel);
|
||||
this.Controls.Add(this.label9);
|
||||
this.Controls.Add(this.label4);
|
||||
this.Controls.Add(this.SavestateSizeLabel);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.label8);
|
||||
this.Controls.Add(this.label7);
|
||||
this.Controls.Add(this.label6);
|
||||
this.Controls.Add(this.label5);
|
||||
this.Controls.Add(this.SaveCapacityNumeric);
|
||||
this.Controls.Add(this.label2);
|
||||
this.ClientSize = new System.Drawing.Size(315, 260);
|
||||
this.Controls.Add(this.groupBox2);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.Controls.Add(this.DiskCapacityNumeric);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.MemCapacityNumeric);
|
||||
this.Controls.Add(this.label5);
|
||||
this.Controls.Add(this.SavestateSizeLabel);
|
||||
this.Controls.Add(this.label6);
|
||||
this.Controls.Add(this.label4);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.NumStatesLabel);
|
||||
this.Controls.Add(this.OkBtn);
|
||||
this.Controls.Add(this.CancelBtn);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
|
@ -369,8 +439,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
this.Load += new System.EventHandler(this.StateHistorySettings_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.MemCapacityNumeric)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.DiskCapacityNumeric)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.SaveCapacityNumeric)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.StateGap)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.FileCapacityNumeric)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.FileStateGapNumeric)).EndInit();
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.MemStateGapDividerNumeric)).EndInit();
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
this.groupBox2.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
|
@ -388,16 +463,21 @@ namespace BizHawk.Client.EmuHawk
|
|||
private NumericUpDown DiskCapacityNumeric;
|
||||
private Label label5;
|
||||
private Label label6;
|
||||
private NumericUpDown SaveCapacityNumeric;
|
||||
private NumericUpDown FileCapacityNumeric;
|
||||
private Label label7;
|
||||
private Label label8;
|
||||
private Label label9;
|
||||
private Label NumSaveStatesLabel;
|
||||
private CheckBox BranchStatesInTasproj;
|
||||
private CheckBox EraseBranchStatesFirst;
|
||||
private NumericUpDown StateGap;
|
||||
private NumericUpDown FileStateGapNumeric;
|
||||
private Label label10;
|
||||
private Label label11;
|
||||
private Label NumFramesLabel;
|
||||
private Label FileNumFramesLabel;
|
||||
private GroupBox groupBox1;
|
||||
private NumericUpDown MemStateGapDividerNumeric;
|
||||
private Label label12;
|
||||
private GroupBox groupBox2;
|
||||
private Label MemFramesLabel;
|
||||
private Label label13;
|
||||
private Label label14;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.Windows.Forms;
|
|||
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Common.NumberExtensions;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
|
@ -24,20 +25,20 @@ namespace BizHawk.Client.EmuHawk
|
|||
_stateSizeMb = Statable.SaveStateBinary().Length / (decimal)1024 / (decimal)1024;
|
||||
|
||||
MemCapacityNumeric.Maximum = 1024 * 8;
|
||||
MemCapacityNumeric.Minimum = _stateSizeMb + 1;
|
||||
|
||||
MemCapacityNumeric.Value = _settings.Capacitymb < MemCapacityNumeric.Maximum ?
|
||||
_settings.Capacitymb : MemCapacityNumeric.Maximum;
|
||||
DiskCapacityNumeric.Value = _settings.DiskCapacitymb < MemCapacityNumeric.Maximum ?
|
||||
_settings.DiskCapacitymb : MemCapacityNumeric.Maximum;
|
||||
SaveCapacityNumeric.Value = _settings.DiskSaveCapacitymb < MemCapacityNumeric.Maximum ?
|
||||
_settings.DiskSaveCapacitymb : MemCapacityNumeric.Maximum;
|
||||
MemStateGapDividerNumeric.Maximum = Statable.SaveStateBinary().Length / 1024 / 2 + 1;
|
||||
MemStateGapDividerNumeric.Minimum = Math.Max(Statable.SaveStateBinary().Length / 1024 / 16, 1);
|
||||
|
||||
StateGap.Value = _settings.StateGap;
|
||||
SavestateSizeLabel.Text = Math.Round(_stateSizeMb, 2).ToString() + " mb";
|
||||
MemCapacityNumeric.Value = NumberExtensions.Clamp(_settings.Capacitymb, MemCapacityNumeric.Minimum, MemCapacityNumeric.Maximum);
|
||||
DiskCapacityNumeric.Value = NumberExtensions.Clamp(_settings.DiskCapacitymb, MemCapacityNumeric.Minimum, MemCapacityNumeric.Maximum);
|
||||
FileCapacityNumeric.Value = NumberExtensions.Clamp(_settings.DiskSaveCapacitymb, MemCapacityNumeric.Minimum, MemCapacityNumeric.Maximum);
|
||||
MemStateGapDividerNumeric.Value = NumberExtensions.Clamp(_settings.MemStateGapDivider, MemStateGapDividerNumeric.Minimum, MemStateGapDividerNumeric.Maximum);
|
||||
|
||||
FileStateGapNumeric.Value = _settings.FileStateGap;
|
||||
SavestateSizeLabel.Text = Math.Round(_stateSizeMb, 2).ToString() + " MB";
|
||||
CapacityNumeric_ValueChanged(null, null);
|
||||
SaveCapacityNumeric_ValueChanged(null, null);
|
||||
BranchStatesInTasproj.Checked = _settings.BranchStatesInTasproj;
|
||||
EraseBranchStatesFirst.Checked = _settings.EraseBranchStatesFirst;
|
||||
}
|
||||
|
||||
private int MaxStatesInCapacity => (int)Math.Floor(MemCapacityNumeric.Value / _stateSizeMb)
|
||||
|
@ -47,8 +48,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
_settings.Capacitymb = (int)MemCapacityNumeric.Value;
|
||||
_settings.DiskCapacitymb = (int)DiskCapacityNumeric.Value;
|
||||
_settings.DiskSaveCapacitymb = (int)SaveCapacityNumeric.Value;
|
||||
_settings.StateGap = (int)StateGap.Value;
|
||||
_settings.DiskSaveCapacitymb = (int)FileCapacityNumeric.Value;
|
||||
_settings.MemStateGapDivider = (int)MemStateGapDividerNumeric.Value;
|
||||
_settings.FileStateGap = (int)FileStateGapNumeric.Value;
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
@ -68,24 +70,26 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void SaveCapacityNumeric_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
NumSaveStatesLabel.Text = ((int)Math.Floor(SaveCapacityNumeric.Value / _stateSizeMb)).ToString();
|
||||
NumSaveStatesLabel.Text = ((int)Math.Floor(FileCapacityNumeric.Value / _stateSizeMb)).ToString();
|
||||
}
|
||||
|
||||
private void BranchStatesInTasproj_CheckedChanged(object sender, EventArgs e)
|
||||
private void FileStateGap_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
_settings.BranchStatesInTasproj = BranchStatesInTasproj.Checked;
|
||||
}
|
||||
|
||||
private void EraseBranchStatesFIrst_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
_settings.EraseBranchStatesFirst = EraseBranchStatesFirst.Checked;
|
||||
}
|
||||
|
||||
private void StateGap_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
NumFramesLabel.Text = StateGap.Value == 0
|
||||
FileNumFramesLabel.Text = FileStateGapNumeric.Value == 0
|
||||
? "frame"
|
||||
: $"{1 << (int)StateGap.Value} frames";
|
||||
: $"{1 << (int)FileStateGapNumeric.Value} frames";
|
||||
}
|
||||
|
||||
private void MemStateGapDivider_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
int val = (int)(Statable.SaveStateBinary().Length / MemStateGapDividerNumeric.Value / 1024);
|
||||
|
||||
if (val <= 1)
|
||||
MemStateGapDividerNumeric.Maximum = MemStateGapDividerNumeric.Value;
|
||||
|
||||
MemFramesLabel.Text = val <= 1
|
||||
? "frame"
|
||||
: $"{val} frames";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,10 +98,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
private void MarkerContextMenu_Opening(object sender, CancelEventArgs e)
|
||||
{
|
||||
EditMarkerToolStripMenuItem.Enabled =
|
||||
RemoveMarkerToolStripMenuItem.Enabled =
|
||||
JumpToMarkerToolStripMenuItem.Enabled =
|
||||
ScrollToMarkerToolStripMenuItem.Enabled =
|
||||
RemoveMarkerToolStripMenuItem.Enabled =
|
||||
MarkerInputRoll.AnyRowsSelected && MarkerView.SelectedRows.First() != 0;
|
||||
|
||||
JumpToMarkerToolStripMenuItem.Enabled =
|
||||
ScrollToMarkerToolStripMenuItem.Enabled =
|
||||
MarkerInputRoll.AnyRowsSelected;
|
||||
}
|
||||
|
||||
private void ScrollToMarkerToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
|
@ -150,12 +152,28 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (MarkerView.AnyRowsSelected)
|
||||
{
|
||||
SelectedMarkers.ForEach(i => Markers.Remove(i));
|
||||
MarkerInputRoll.DeselectAll();
|
||||
ShrinkSelection();
|
||||
Tastudio.RefreshDialog();
|
||||
MarkerView_SelectedIndexChanged(null, null);
|
||||
}
|
||||
}
|
||||
|
||||
// feos: not the same as InputRoll.TruncateSelection(), since multiple selection of markers is forbidden
|
||||
// moreover, when the last marker is removed, we need its selection to move to the previous marker
|
||||
// still iterate, so things don't break if multiple selection is allowed someday
|
||||
public void ShrinkSelection()
|
||||
{
|
||||
if (MarkerView.AnyRowsSelected)
|
||||
{
|
||||
while (MarkerView.SelectedRows.Last() > Markers.Count() - 1)
|
||||
{
|
||||
MarkerView.SelectRow(Markers.Count(), false);
|
||||
MarkerView.SelectRow(Markers.Count() - 1, true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void AddMarker(bool editText = false, int? frame = null)
|
||||
{
|
||||
// feos: we specify the selected frame if we call this from TasView, otherwise marker should be added to the emulated frame
|
||||
|
@ -190,6 +208,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
UpdateValues();
|
||||
}
|
||||
|
||||
MarkerView.ScrollToIndex(Markers.Count() - 1);
|
||||
Tastudio.RefreshDialog();
|
||||
}
|
||||
|
||||
|
@ -242,17 +261,20 @@ namespace BizHawk.Client.EmuHawk
|
|||
private void MarkerView_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
EditMarkerButton.Enabled =
|
||||
RemoveMarkerButton.Enabled =
|
||||
JumpToMarkerButton.Enabled =
|
||||
ScrollToMarkerButton.Enabled =
|
||||
RemoveMarkerButton.Enabled =
|
||||
MarkerInputRoll.AnyRowsSelected && MarkerView.SelectedRows.First() != 0;
|
||||
|
||||
JumpToMarkerButton.Enabled =
|
||||
ScrollToMarkerButton.Enabled =
|
||||
MarkerInputRoll.AnyRowsSelected;
|
||||
}
|
||||
|
||||
private List<TasMovieMarker> SelectedMarkers
|
||||
{
|
||||
get
|
||||
{
|
||||
return MarkerView.SelectedRows
|
||||
return MarkerView
|
||||
.SelectedRows
|
||||
.Select(index => Markers[index])
|
||||
.ToList();
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.PlaybackGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.RecordingModeCheckbox = new System.Windows.Forms.CheckBox();
|
||||
this.AutoRestoreCheckbox = new System.Windows.Forms.CheckBox();
|
||||
|
@ -38,6 +39,7 @@
|
|||
this.PauseButton = new System.Windows.Forms.Button();
|
||||
this.RewindButton = new BizHawk.Client.EmuHawk.RepeatButton();
|
||||
this.PreviousMarkerButton = new System.Windows.Forms.Button();
|
||||
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
|
||||
this.PlaybackGroupBox.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
|
@ -125,6 +127,7 @@
|
|||
this.FrameAdvanceButton.Size = new System.Drawing.Size(38, 23);
|
||||
this.FrameAdvanceButton.TabIndex = 3;
|
||||
this.FrameAdvanceButton.Text = ">";
|
||||
this.toolTip1.SetToolTip(this.FrameAdvanceButton, "Right Mouse Button + Wheel Down");
|
||||
this.FrameAdvanceButton.UseVisualStyleBackColor = true;
|
||||
this.FrameAdvanceButton.MouseDown += new System.Windows.Forms.MouseEventHandler(this.FrameAdvanceButton_MouseDown);
|
||||
this.FrameAdvanceButton.MouseLeave += new System.EventHandler(this.FrameAdvanceButton_MouseLeave);
|
||||
|
@ -137,6 +140,7 @@
|
|||
this.PauseButton.Size = new System.Drawing.Size(38, 23);
|
||||
this.PauseButton.TabIndex = 2;
|
||||
this.PauseButton.Text = "| |";
|
||||
this.toolTip1.SetToolTip(this.PauseButton, "Middle Mouse Button");
|
||||
this.PauseButton.UseVisualStyleBackColor = true;
|
||||
this.PauseButton.Click += new System.EventHandler(this.PauseButton_Click);
|
||||
//
|
||||
|
@ -149,6 +153,7 @@
|
|||
this.RewindButton.Size = new System.Drawing.Size(38, 23);
|
||||
this.RewindButton.TabIndex = 1;
|
||||
this.RewindButton.Text = "<";
|
||||
this.toolTip1.SetToolTip(this.RewindButton, "Right Mouse Button + Wheel Up");
|
||||
this.RewindButton.UseVisualStyleBackColor = true;
|
||||
this.RewindButton.MouseDown += new System.Windows.Forms.MouseEventHandler(this.RewindButton_MouseDown);
|
||||
this.RewindButton.MouseLeave += new System.EventHandler(this.RewindButton_MouseLeave);
|
||||
|
@ -188,5 +193,6 @@
|
|||
private System.Windows.Forms.CheckBox TurboSeekCheckbox;
|
||||
private System.Windows.Forms.CheckBox FollowCursorCheckbox;
|
||||
private System.Windows.Forms.CheckBox RecordingModeCheckbox;
|
||||
private System.Windows.Forms.ToolTip toolTip1;
|
||||
}
|
||||
}
|
|
@ -117,4 +117,7 @@
|
|||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
|
@ -11,11 +11,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
public partial class ScreenshotForm : Form
|
||||
{
|
||||
// but still appear topmost
|
||||
private const int WS_EX_TOPMOST = 0x00000008;
|
||||
|
||||
private const int WidthCap = 320;
|
||||
private const int HeightCap = 240;
|
||||
|
||||
private const int Interval = 40;
|
||||
private const double AlphaStep = 0.125;
|
||||
|
||||
|
@ -32,9 +29,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
public ScreenshotForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Width = WidthCap;
|
||||
Height = HeightCap;
|
||||
|
||||
var fontSize = 10;
|
||||
var fontStyle = FontStyle.Regular;
|
||||
Font = new Font(FontFamily.GenericMonospace, fontSize, fontStyle);
|
||||
|
@ -71,15 +66,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
Text = _branch.UserText;
|
||||
Location = location;
|
||||
|
||||
// Set the screenshot to "1x" resolution of the core
|
||||
// cores like n64 and psx are going to still have sizes too big for the control, so cap them
|
||||
if (Width > WidthCap)
|
||||
{
|
||||
double ratio = WidthCap / (double)Width;
|
||||
Width = WidthCap;
|
||||
_drawingHeight = (int)((double)(_drawingHeight) * ratio);
|
||||
}
|
||||
|
||||
if (Padding > 0)
|
||||
{
|
||||
Padding += 2;
|
||||
|
|
|
@ -11,6 +11,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
public Func<int, string, Bitmap> QueryItemIconCallback { get; set; }
|
||||
|
||||
public Action<int> GreenzoneInvalidatedCallback { get; set; }
|
||||
public Action<int> BranchLoadedCallback { get; set; }
|
||||
public Action<int> BranchSavedCallback { get; set; }
|
||||
public Action<int> BranchRemovedCallback { get; set; }
|
||||
|
||||
private Color? GetColorOverride(int index, InputRoll.RollColumn column)
|
||||
{
|
||||
|
@ -31,5 +34,20 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
GreenzoneInvalidatedCallback?.Invoke(index);
|
||||
}
|
||||
|
||||
private void BranchLoaded(int index)
|
||||
{
|
||||
BranchLoadedCallback?.Invoke(index);
|
||||
}
|
||||
|
||||
private void BranchSaved(int index)
|
||||
{
|
||||
BranchSavedCallback?.Invoke(index);
|
||||
}
|
||||
|
||||
private void BranchRemoved(int index)
|
||||
{
|
||||
BranchRemovedCallback?.Invoke(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
private bool _startSelectionDrag;
|
||||
private bool _selectionDragState;
|
||||
private bool _supressContextMenu;
|
||||
private int _startrow;
|
||||
|
||||
// Editing analog input
|
||||
private string _floatEditColumn = "";
|
||||
|
@ -63,7 +64,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
public AutoPatternBool[] BoolPatterns;
|
||||
public AutoPatternFloat[] FloatPatterns;
|
||||
|
||||
private void JumpToGreenzone()
|
||||
public void JumpToGreenzone()
|
||||
{
|
||||
if (Emulator.Frame > CurrentTasMovie.LastValidFrame)
|
||||
{
|
||||
|
@ -367,7 +368,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (columnName == FrameColumnName)
|
||||
{
|
||||
CurrentTasMovie.Markers.Add(TasView.LastSelectedIndex.Value, "");
|
||||
RefreshDialog();
|
||||
}
|
||||
else if (columnName != CursorColumnName)
|
||||
{
|
||||
|
@ -376,18 +376,29 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
if (Global.MovieSession.MovieControllerAdapter.Definition.BoolButtons.Contains(buttonName))
|
||||
{
|
||||
// nifty taseditor logic
|
||||
bool allPressed = true;
|
||||
foreach (var index in TasView.SelectedRows)
|
||||
if (Control.ModifierKeys != Keys.Alt)
|
||||
{
|
||||
if ((index == CurrentTasMovie.FrameCount) // last movie frame can't have input, but can be selected
|
||||
|| (!CurrentTasMovie.BoolIsPressed(index, buttonName)))
|
||||
// nifty taseditor logic
|
||||
bool allPressed = true;
|
||||
foreach (var index in TasView.SelectedRows)
|
||||
{
|
||||
allPressed = false;
|
||||
break;
|
||||
if ((index == CurrentTasMovie.FrameCount) // last movie frame can't have input, but can be selected
|
||||
|| (!CurrentTasMovie.BoolIsPressed(index, buttonName)))
|
||||
{
|
||||
allPressed = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
CurrentTasMovie.SetBoolStates(frame, TasView.SelectedRows.Count(), buttonName, !allPressed);
|
||||
}
|
||||
else
|
||||
{
|
||||
BoolPatterns[ControllerType.BoolButtons.IndexOf(buttonName)].Reset();
|
||||
foreach (var index in TasView.SelectedRows)
|
||||
{
|
||||
CurrentTasMovie.SetBoolState(index, buttonName, BoolPatterns[ControllerType.BoolButtons.IndexOf(buttonName)].GetNextValue());
|
||||
}
|
||||
}
|
||||
CurrentTasMovie.SetBoolStates(frame, TasView.SelectedRows.Count(), buttonName, !allPressed);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -397,8 +408,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
_triggerAutoRestore = true;
|
||||
JumpToGreenzone();
|
||||
RefreshDialog();
|
||||
}
|
||||
RefreshDialog();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -582,32 +593,63 @@ namespace BizHawk.Client.EmuHawk
|
|||
_selectionDragState = TasView.SelectedRows.Contains(frame);
|
||||
}
|
||||
}
|
||||
else // User changed input
|
||||
else if (TasView.CurrentCell.Column.Type != InputRoll.RollColumn.InputType.Text)// User changed input
|
||||
{
|
||||
bool wasPaused = Mainform.EmulatorPaused;
|
||||
|
||||
if (Global.MovieSession.MovieControllerAdapter.Definition.BoolButtons.Contains(buttonName))
|
||||
{
|
||||
CurrentTasMovie.ChangeLog.BeginNewBatch("Paint Bool " + buttonName + " from frame " + frame);
|
||||
|
||||
CurrentTasMovie.ToggleBoolState(TasView.CurrentCell.RowIndex.Value, buttonName);
|
||||
_triggerAutoRestore = true;
|
||||
JumpToGreenzone();
|
||||
RefreshDialog();
|
||||
|
||||
_patternPaint = false;
|
||||
_startBoolDrawColumn = buttonName;
|
||||
|
||||
_boolPaintState = CurrentTasMovie.BoolIsPressed(frame, buttonName);
|
||||
if (applyPatternToPaintedInputToolStripMenuItem.Checked && (!onlyOnAutoFireColumnsToolStripMenuItem.Checked
|
||||
|| TasView.CurrentCell.Column.Emphasis))
|
||||
if ((Control.ModifierKeys == Keys.Alt && Control.ModifierKeys != Keys.Shift) || (applyPatternToPaintedInputToolStripMenuItem.Checked && (!onlyOnAutoFireColumnsToolStripMenuItem.Checked
|
||||
|| TasView.CurrentCell.Column.Emphasis)))
|
||||
{
|
||||
BoolPatterns[ControllerType.BoolButtons.IndexOf(buttonName)].Reset();
|
||||
BoolPatterns[ControllerType.BoolButtons.IndexOf(buttonName)].GetNextValue();
|
||||
//BoolPatterns[ControllerType.BoolButtons.IndexOf(buttonName)].GetNextValue();
|
||||
_patternPaint = true;
|
||||
_startrow = TasView.CurrentCell.RowIndex.Value;
|
||||
_boolPaintState = !CurrentTasMovie.BoolIsPressed(frame, buttonName);
|
||||
}
|
||||
else if (Control.ModifierKeys == Keys.Shift && Control.ModifierKeys != Keys.Alt)
|
||||
{
|
||||
int firstSel = TasView.SelectedRows.First();
|
||||
|
||||
if (frame <= firstSel)
|
||||
{
|
||||
firstSel = frame;
|
||||
frame = TasView.SelectedRows.First();
|
||||
}
|
||||
|
||||
bool allPressed = true;
|
||||
for (int i = firstSel; i <= frame; i++)
|
||||
{
|
||||
if ((i == CurrentTasMovie.FrameCount) // last movie frame can't have input, but can be selected
|
||||
|| (!CurrentTasMovie.BoolIsPressed(i, buttonName)))
|
||||
{
|
||||
allPressed = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
CurrentTasMovie.SetBoolStates(firstSel, (frame - firstSel) + 1, buttonName, !allPressed);
|
||||
_boolPaintState = CurrentTasMovie.BoolIsPressed(frame, buttonName);
|
||||
_triggerAutoRestore = true;
|
||||
JumpToGreenzone();
|
||||
RefreshDialog();
|
||||
}
|
||||
else if (Control.ModifierKeys == Keys.Shift && Control.ModifierKeys == Keys.Alt) //Does not work?
|
||||
{
|
||||
// TODO: Pattern drawing from selection to current cell
|
||||
}
|
||||
else
|
||||
{
|
||||
_patternPaint = false;
|
||||
CurrentTasMovie.ChangeLog.BeginNewBatch("Paint Bool " + buttonName + " from frame " + frame);
|
||||
|
||||
CurrentTasMovie.ToggleBoolState(TasView.CurrentCell.RowIndex.Value, buttonName);
|
||||
_boolPaintState = CurrentTasMovie.BoolIsPressed(frame, buttonName);
|
||||
_triggerAutoRestore = true;
|
||||
JumpToGreenzone();
|
||||
RefreshDialog();
|
||||
}
|
||||
|
||||
if (!Settings.AutoRestoreOnMouseUpOnly)
|
||||
|
@ -888,6 +930,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
return;
|
||||
}
|
||||
|
||||
if (!MouseButtonHeld)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// skip rerecord counting on drawing entirely, mouse down is enough
|
||||
// avoid introducing another global
|
||||
bool wasCountingRerecords = Global.MovieSession.Movie.IsCountingRerecords;
|
||||
|
@ -899,11 +946,19 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
startVal = e.OldCell.RowIndex.Value;
|
||||
endVal = e.NewCell.RowIndex.Value;
|
||||
if (_patternPaint)
|
||||
{
|
||||
endVal--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
startVal = e.NewCell.RowIndex.Value;
|
||||
endVal = e.OldCell.RowIndex.Value;
|
||||
if(_patternPaint)
|
||||
{
|
||||
endVal = _startrow;
|
||||
}
|
||||
}
|
||||
|
||||
if (_startCursorDrag && !Mainform.IsSeeking)
|
||||
|
@ -1050,9 +1105,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
if (e.OldCell.RowIndex.HasValue && e.NewCell.RowIndex.HasValue)
|
||||
{
|
||||
|
||||
|
||||
for (int i = startVal; i <= endVal; i++) // Inclusive on both ends (drawing up or down)
|
||||
{
|
||||
bool setVal = _boolPaintState;
|
||||
|
||||
if (_patternPaint && _boolPaintState)
|
||||
{
|
||||
if (CurrentTasMovie[frame].Lagged.HasValue && CurrentTasMovie[frame].Lagged.Value)
|
||||
|
@ -1065,7 +1123,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
CurrentTasMovie.SetBoolState(i, _startBoolDrawColumn, setVal); // Notice it uses new row, old column, you can only paint across a single column
|
||||
CurrentTasMovie.SetBoolState(i, _startBoolDrawColumn, setVal); // Notice it uses new row, old column, you can only paint across a single column
|
||||
JumpToGreenzone();
|
||||
}
|
||||
|
||||
|
@ -1123,39 +1181,43 @@ namespace BizHawk.Client.EmuHawk
|
|||
private void TasView_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
// For float editing
|
||||
int increment = (_floatEditYPos - e.Y) / 4;
|
||||
if (_floatEditYPos == -1)
|
||||
return;
|
||||
|
||||
float value = _floatPaintState + increment;
|
||||
ControllerDefinition.FloatRange range = Global.MovieSession.MovieControllerAdapter.Definition.FloatRanges
|
||||
[Global.MovieSession.MovieControllerAdapter.Definition.FloatControls.IndexOf(_floatEditColumn)];
|
||||
|
||||
// Range for N64 Y axis has max -128 and min 127. That should probably be fixed in ControllerDefinition.cs.
|
||||
// SuuperW: I really don't think changing it would break anything, but adelikat isn't so sure.
|
||||
float rMax = range.Max;
|
||||
float rMin = range.Min;
|
||||
if (rMax < rMin)
|
||||
if (FloatEditingMode)
|
||||
{
|
||||
rMax = range.Min;
|
||||
rMin = range.Max;
|
||||
}
|
||||
int increment = (_floatEditYPos - e.Y) / 4;
|
||||
if (_floatEditYPos == -1)
|
||||
return;
|
||||
|
||||
if (value > rMax)
|
||||
{
|
||||
value = rMax;
|
||||
}
|
||||
else if (value < rMin)
|
||||
{
|
||||
value = rMin;
|
||||
}
|
||||
float value = _floatPaintState + increment;
|
||||
ControllerDefinition.FloatRange range = Global.MovieSession.MovieControllerAdapter.Definition.FloatRanges
|
||||
[Global.MovieSession.MovieControllerAdapter.Definition.FloatControls.IndexOf(_floatEditColumn)];
|
||||
|
||||
CurrentTasMovie.SetFloatState(_floatEditRow, _floatEditColumn, value);
|
||||
_floatTypedValue = value.ToString();
|
||||
// Range for N64 Y axis has max -128 and min 127. That should probably be fixed in ControllerDefinition.cs.
|
||||
// SuuperW: I really don't think changing it would break anything, but adelikat isn't so sure.
|
||||
float rMax = range.Max;
|
||||
float rMin = range.Min;
|
||||
if (rMax < rMin)
|
||||
{
|
||||
rMax = range.Min;
|
||||
rMin = range.Max;
|
||||
}
|
||||
|
||||
_triggerAutoRestore = true;
|
||||
JumpToGreenzone();
|
||||
DoTriggeredAutoRestoreIfNeeded();
|
||||
if (value > rMax)
|
||||
{
|
||||
value = rMax;
|
||||
}
|
||||
else if (value < rMin)
|
||||
{
|
||||
value = rMin;
|
||||
}
|
||||
|
||||
CurrentTasMovie.SetFloatState(_floatEditRow, _floatEditColumn, value);
|
||||
_floatTypedValue = value.ToString();
|
||||
|
||||
_triggerAutoRestore = true;
|
||||
JumpToGreenzone();
|
||||
DoTriggeredAutoRestoreIfNeeded();
|
||||
|
||||
}
|
||||
RefreshDialog();
|
||||
}
|
||||
|
||||
|
@ -1411,16 +1473,34 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void TasView_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Control && !e.Shift && !e.Alt && e.KeyCode == Keys.Left) // Ctrl + Left
|
||||
//taseditor uses Ctrl for selection and Shift for framecourser
|
||||
if (!e.Control && e.Shift && !e.Alt && e.KeyCode == Keys.PageUp) // Shift + Page Up
|
||||
{
|
||||
GoToPreviousMarker();
|
||||
}
|
||||
else if (e.Control && !e.Shift && !e.Alt && e.KeyCode == Keys.Right) // Ctrl + Right
|
||||
else if (!e.Control && e.Shift && !e.Alt && e.KeyCode == Keys.PageDown) // Shift + Page Down
|
||||
{
|
||||
GoToNextMarker();
|
||||
}
|
||||
else if (!e.Control && e.Shift && !e.Alt && e.KeyCode == Keys.Home) // Shift + Home
|
||||
{
|
||||
GoToFrame(0);
|
||||
}
|
||||
else if (!e.Control && e.Shift && !e.Alt && e.KeyCode == Keys.End) // Shift + End
|
||||
{
|
||||
GoToFrame(CurrentTasMovie.InputLogLength-1);
|
||||
}
|
||||
else if (!e.Control && e.Shift && !e.Alt && e.KeyCode == Keys.Up) // Shift + Up
|
||||
{
|
||||
//GoToPreviousFrame();
|
||||
}
|
||||
else if (!e.Control && e.Shift && !e.Alt && e.KeyCode == Keys.Down) // Shift + Down
|
||||
{
|
||||
//GoToNextFrame();
|
||||
}
|
||||
|
||||
if (FloatEditingMode && e.KeyCode != Keys.Right
|
||||
if (FloatEditingMode
|
||||
&& e.KeyCode != Keys.Right
|
||||
&& e.KeyCode != Keys.Left
|
||||
&& e.KeyCode != Keys.Up
|
||||
&& e.KeyCode != Keys.Down)
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue