Merge branch 'master' into brian/mem_callback_addr_value

This commit is contained in:
Brian Armstrong 2019-06-06 02:11:04 -07:00
commit 2c6ecb68bd
848 changed files with 28984 additions and 16419 deletions

5
.gitignore vendored
View File

@ -12,6 +12,7 @@ svnrev.cs
**/ipch/**
*.ilk
*.il
*.tlog
*.obj
*.o
@ -74,3 +75,7 @@ libsnes/vs2015/libsnes.VC.db
waterbox/**/*.wbx
waterbox/**/*.wbx.in
/BizHawkTool_template.zip
mono_crash*
.idea

View File

@ -8,11 +8,14 @@ libpath=""
if [ "$(command -v lsb_release)" ]; then
case "$(lsb_release -i | cut -c17- | tr -d "\n")" in
"Arch"|"ManjaroLinux") libpath="/usr/lib/wine";;
"Debian"|"Ubuntu"|"LinuxMint") libpath="/usr/lib/x86_64-linux-gnu/wine";;
"Debian"|"LinuxMint") libpath="/usr/lib/x86_64-linux-gnu/wine";;
"Ubuntu") libpath="/usr/lib/x86_64-linux-gnu/wine"; export MONO_WINFORMS_XIM_STYLE=disabled;; # see https://bugzilla.xamarin.com/show_bug.cgi?id=28047#c9
esac
else
printf "Distro does not provide LSB release info API! (You've met with a terrible fate, haven't you?)\n"
fi
if [ -z "$libpath" ]; then
printf "%s\n" "Unknown distro, assuming WINE library location is /usr/lib/wine..."
libpath="/usr/lib/wine"
fi
LD_LIBRARY_PATH="$libpath" mono ./EmuHawk.exe
LD_LIBRARY_PATH="$libpath" mono ./EmuHawk.exe >EmuHawkMono_laststdout.txt

View File

@ -21,11 +21,13 @@
#include gamedb_sega_md.txt
#include gamedb_snes.txt
#include gamedb_user.txt
#include gamedb_vectrex.txt
#include gamedb_ws.txt
#include gamedb_wsc.txt
#include gamedb_zxspectrum.txt
#include gamedb_amstradcpc.txt
#include gamedb_ngp.txt
#include gamedb_channelf.txt
; ************ TI-83 ************

View File

@ -50,9 +50,9 @@ sha1:a65f487740069640952803218b70580b2fb724b7 A-Team, The (Atari) (Prototype) (
sha1:821cffe5f5940b2951f280d07d2691e140f54ad2 A-Team, The (Atari) (Prototype) (PAL-60) [!] A26 m=F8;NTSC=true
sha1:53413577afe7def1d390e3892c45822405513c07 A-Team, The (Atari) (Prototype) [!] A26 m=F8;NTSC=true
sha1:3607f46475f4b1b8989f7327f90ca53a4ac0e9fe A-VCS-tec Challenge (beta 5) (PD) A26 m=F8;NTSC=true
sha1:d7c62df8300a68b21ce672cfaa4d0f2f4b3d0ce1 Acid Drop (1992) (Salu) (PAL) [!] A26 m=F6;PAL=true
sha1:66216ed98295f3fde35a0cc9398b4f2fc79f2375 Acid Drop (1992) (Salu) (PAL) [b1] A26 m=F8;PAL=true
sha1:2ad5e47e360842bb5f9c23bbe2c19866d890f427 Acid Drop (NTSC Conversion) (TJ) A26 m=F8;NTSC=true
sha1:d7c62df8300a68b21ce672cfaa4d0f2f4b3d0ce1 Acid Drop (1992) (Salu) (PAL) [!] A26 SP_RESET=true;m=F6;PAL=true
sha1:66216ed98295f3fde35a0cc9398b4f2fc79f2375 Acid Drop (1992) (Salu) (PAL) [b1] A26 SP_RESET=true;m=F8;PAL=true
sha1:2ad5e47e360842bb5f9c23bbe2c19866d890f427 Acid Drop (NTSC Conversion) (TJ) A26 SP_RESET=true;m=F8;NTSC=true
sha1:9e6fb047ee9fa0a454ca23673ed9693430032dc6 Action Force (1983) (Parker Bros) (PAL) [!] A26 m=4K;PAL=true
sha1:bfcc35feee3713f5028122844d027c88a84772b6 2 Pak Special Red - Motocross,Boom Bang (1990) (PAL) [!] A26 m=F6;PAL=true
sha1:8a503416ca6f2404bc52382e337f31238bba9534 3-D Corridor Demo 2 (29-03-2003) (MP) A26 m=4K;NTSC=true
@ -68,13 +68,13 @@ sha1:317a7b8693af44095c23437253a32cc748824ccf Adventure (Color Scrolling) [h1]
sha1:4ffe36c5113305714e27c72d7f3abecc9b08a630 Adventure (New Graphics) [h1] A26 m=4K;NTSC=true
sha1:0b0875ad1bd494c9dd8de4ff0a06938e699f60d5 Adventure 34 by Kurt Howe (Adventure Hack) A26 m=4K;NTSC=true
sha1:8501444b12f7f9e2103cd2bcf0c8d3f5b7536569 Adventure II (Adventure Hack) A26 m=4K;NTSC=true
sha1:03a495c7bfa0671e24aa4d9460d232731f68cb43 Adventures of Tron (1983) (Mattel) A26 m=4K;NTSC=true
sha1:03a495c7bfa0671e24aa4d9460d232731f68cb43 Adventures of Tron (1983) (Mattel) A26 SP_RESET=true;m=4K;NTSC=true
sha1:6e420544bf91f603639188824a2b570738bb7e02 Adventures on GX-12 (Telegames) (PAL) [!] A26 m=4K;PAL=true
sha1:3b02e7dacb418c44d0d3dc77d60a9663b90b0fbc Air Raid (Men-A-Vision) A26 m=4K;NTSC=true
sha1:e65a0c6c5a1f9f05ebcfaaa7b2c9ee6625bf2d83 Air Raiders (1982) (Mattel) (PAL) [p1][!] A26 m=4K;PAL=true
sha1:29f5c73d1fe806a4284547274dd73f9972a7ed70 Air Raiders (1982) (Mattel) [!] A26 m=4K;NTSC=true
sha1:a9a51405b521ae0b465f521fa098e8b3aedd018b Air Raiders (1982) (Mattel) [a1][!] A26 m=4K;NTSC=true
sha1:39a98b42f0670dfe6a842645f09f24583ae8ee60 Air Raiders (1982) (Mattel) [h1] A26 m=4K;NTSC=true
sha1:e65a0c6c5a1f9f05ebcfaaa7b2c9ee6625bf2d83 Air Raiders (1982) (Mattel) (PAL) [p1][!] A26 SP_RESET=true;m=4K;PAL=true
sha1:29f5c73d1fe806a4284547274dd73f9972a7ed70 Air Raiders (1982) (Mattel) [!] A26 SP_RESET=true;m=4K;NTSC=true
sha1:a9a51405b521ae0b465f521fa098e8b3aedd018b Air Raiders (1982) (Mattel) [a1][!] A26 SP_RESET=true;m=4K;NTSC=true
sha1:39a98b42f0670dfe6a842645f09f24583ae8ee60 Air Raiders (1982) (Mattel) [h1] A26 SP_RESET=true;m=4K;NTSC=true
sha1:b96c7a509bf610f61f82377bfd506db3dba2b423 Air-Sea Battle (1977) (Atari) (PAL) [!] A26 m=2K;PAL=true
sha1:a746fdc82b336a9d499bf17f50b41e0193ba595e Air-Sea Battle (1977) (Atari) [!] A26 m=2K;NTSC=true
sha1:d3897fc60585e420ae816a2db909400f6cbadd88 Air-Sea Battle (1977) (Atari) [o1] A26 m=2K;NTSC=true
@ -323,9 +323,9 @@ sha1:67387d0d3d48a44800c44860bf15339a81f41aa9 Bugs (1982) (Data Age) [!] A26 m
sha1:a8aedea627c67c38032cdde441fb98dad226916a Bugs (1983) (Gameworld) (PAL) [!] A26 m=4K;PAL=true
sha1:9c0e13af336a986c271fe828fafdca250afba647 Bugs Bunny (Atari) (Prototype) [!] A26 m=F8;NTSC=true
sha1:13534da5c382ed20d070ffe93f35c4c11b36e1bc Bullet Demo (20-12-2002) (CT) A26 m=4K;NTSC=true
sha1:5614c32e76c8b272c38c16720ebbb1818d3d3103 Bump 'N' Jump (1983) (Mattel) [b1] A26 m=F6;NTSC=true
sha1:1819ef408c1216c83dcfeceec28d13f6ea5ca477 Bump 'N' Jump (1983) (Mattel) A26 m=E7;NTSC=true
sha1:35bc4048f58bb170313872a0bce44fb1ca3217cc Bump 'N' Jump (Telegames) (PAL) [!] A26 m=F8;PAL=true
sha1:5614c32e76c8b272c38c16720ebbb1818d3d3103 Bump 'N' Jump (1983) (Mattel) [b1] A26 SP_RESET=true;m=F6;NTSC=true
sha1:1819ef408c1216c83dcfeceec28d13f6ea5ca477 Bump 'N' Jump (1983) (Mattel) A26 SP_RESET=true;m=E7;NTSC=true
sha1:35bc4048f58bb170313872a0bce44fb1ca3217cc Bump 'N' Jump (Telegames) (PAL) [!] A26 SP_RESET=true;m=F8;PAL=true
sha1:ad48f4952e867a2b97900d965b69f50fddf8ba2d Bumper Bash (1983) (Spectravideo) (PAL) [!] A26 m=4K;PAL=true
sha1:6c199782c79686dc0cbce6d5fe805f276a86a3f5 Bumper Bash (1983) (Spectravideo) A26 m=4K;NTSC=true
sha1:49e01b8048ae344cb65838f6b1c1de0e1f416f29 Burgertime (1982) (Mattel) A26 SP_RESET=true;m=E7;NTSC=true
@ -855,8 +855,8 @@ sha1:6b9e591cc53844795725fc66c564f0364d1fbe40 Frogger II - Threedeep! (1983) (P
sha1:bce92de22fc8950f0eebb643d96fe9fa5dba2b72 Frogger II - Threedeep! (1984) (Parker Bros) (PAL) [!] A26 m=E0;PAL=true
sha1:5215cf9051e833482e115d16ff90fee5f01c3e84 Frogger Preview (1982) (Starpath) [a1] A26 m=AR;NTSC=true
sha1:2edb64be1bb6f4215f520ec2f487b19f29724b8d Frogger Preview (1982) (Starpath) A26 m=AR;NTSC=true
sha1:7682b4b6d45865b7eec1244e5d76f0f2efdb17e7 Frogs and Flies (1982) (Mattel) (PAL) [p1][!] A26 m=4K;PAL=true
sha1:f344d5a8dc895c5a2ae0288f3c6cb66650e49167 Frogs and Flies (1982) (Mattel) [!] A26 m=4K;NTSC=true
sha1:7682b4b6d45865b7eec1244e5d76f0f2efdb17e7 Frogs and Flies (1982) (Mattel) (PAL) [p1][!] A26 SP_RESET=true;m=4K;PAL=true
sha1:f344d5a8dc895c5a2ae0288f3c6cb66650e49167 Frogs and Flies (1982) (Mattel) [!] A26 SP_RESET=true;m=4K;NTSC=true
sha1:cf32bfcd7f2c3b7d2a6ad2f298aea2dfad8242e7 Front Line (1982) (Coleco) A26 m=F8;NTSC=true
sha1:58a6f82434ccf49ca420596809ce9545373845a2 Frostbite (1983) (Activision) (PAL) [!] A26 m=4K;PAL=true
sha1:8ad03667bbf73d3c7760cb82f2c4442f8745483c Frostbite (1983) (Activision) (PAL) [p1][!] A26 m=4K;PAL=true
@ -1256,9 +1256,9 @@ sha1:128c3a98d78b043edabe8964cf7998955342fa2d Kiss Meets Pacman (Cody Pittman)
sha1:45623a1c8fb5074de98c37f005edd5b1d0937dae Klax (1990) (Atari) (PAL) [!] A26 m=F6SC;PAL=true
sha1:3162259c6dbfbb57a2ea41d849155702151ee39b Klax (1990) (Atari) A26 m=F6SC;NTSC=true
sha1:759597d1d779cfdfd7aa30fd28a59acc58ca2533 Knight on the Town (1982) (Playaround) A26 m=4K;NTSC=true
sha1:2f550743e237f6dc8c75c389a01b02e9a396fdad Kool Aid Man (1982) (Mattel) A26 m=4K;NTSC=true
sha1:f5c193ed00bf557ddd5ab698d92a7483b89c6519 Kool Aid Man (Fixed) (15-11-2002) (CT) A26 m=4K;NTSC=true
sha1:38f55fc76bec14eb661a7b594301c271aa5f5f3b Kool Aid Man (PAL Conversion) (16-11-2002) (Fabrizio Zavagli) A26 m=4K;NTSC=true
sha1:2f550743e237f6dc8c75c389a01b02e9a396fdad Kool Aid Man (1982) (Mattel) A26 SP_RESET=true;m=4K;NTSC=true
sha1:f5c193ed00bf557ddd5ab698d92a7483b89c6519 Kool Aid Man (Fixed) (15-11-2002) (CT) A26 SP_RESET=true;m=4K;NTSC=true
sha1:38f55fc76bec14eb661a7b594301c271aa5f5f3b Kool Aid Man (PAL Conversion) (16-11-2002) (Fabrizio Zavagli) A26 SP_RESET=true;m=4K;NTSC=true
sha1:82e64366795b011c2a2f1755bf899cc2c0617fe8 Krieg Der Sterne (Atlantis-Ariola) (PAL) [!] A26 m=4K;PAL=true
sha1:4bdf1cf73316bdb0002606facf11b6ddcb287207 Krull (1983) (Atari) [!] A26 m=F8;NTSC=true
sha1:07a1c1b1a2297c4edde0e16f610b5ec23c775217 Krull (CCE) A26 m=F8;NTSC=true
@ -1305,9 +1305,9 @@ sha1:4f3e51f68c10d2fa7c4b9764b0cb81fdded0fde4 Lilly Adventure (Starsoft) (NTSC
sha1:63f4776aa4c35d124001918b733cdb4d46dfbe9b Lilly Adventure (Starsoft) (PAL) [!] A26 m=4K;PAL=true
sha1:5425578808363ee72dbba6195533549679137777 Lines Demo (Eckhard Stolberg) (PAL) (PD) A26 m=2K;PAL=true
sha1:fe208ad775cbf9523e7a99632b9f10f2c9c7aa87 Lochjaw (1982) (Apollo) A26 m=4K;NTSC=true
sha1:119171935ed9ea877de4f2a68aee31cd55bc697d Lock 'N' Chase (1982) (Mattel) (PAL) [p1][!] A26 m=4K;PAL=true
sha1:fc3d75d46d917457aa1701bf47844817d0ba96c3 Lock 'N' Chase (1982) (Mattel) [!] A26 m=4K;NTSC=true
sha1:075ec3678ceabbee46a7d576fdd199a4ab908cc0 Lock 'N' Chase (1982) (Telegames) (PAL) [!] A26 m=4K;PAL=true
sha1:119171935ed9ea877de4f2a68aee31cd55bc697d Lock 'N' Chase (1982) (Mattel) (PAL) [p1][!] A26 SP_RESET=true;m=4K;PAL=true
sha1:fc3d75d46d917457aa1701bf47844817d0ba96c3 Lock 'N' Chase (1982) (Mattel) [!] A26 SP_RESET=true;m=4K;NTSC=true
sha1:075ec3678ceabbee46a7d576fdd199a4ab908cc0 Lock 'N' Chase (1982) (Telegames) (PAL) [!] A26 SP_RESET=true;m=4K;PAL=true
sha1:ef02fdb94ac092247bfcd5f556e01a68c06a4832 Lord of The Rings (1983) (Parker Bros) (Prototype) A26 m=E0;NTSC=true
sha1:43575ed97f8a585c5bae6fb1a7b2133c87b4d256 Lord of the Rings - Fellowship of the Ring by Adam Thornton (Dark Mage Hack) (PD) [a1] A26 m=4K;NTSC=true
sha1:721514e5c31c8f2b30b4a2bf2cda69a810cac75b Lord of the Rings - Fellowship of the Ring by Adam Thornton (Dark Mage Hack) (PD) A26 m=4K;NTSC=true
@ -1359,8 +1359,8 @@ sha1:6ef010513e01520560616994cbe3f10995490996 Max3 (2001) (Maxime Beauvais) (PD
sha1:a2b13017d759346174e3d8dd53b6347222d3b85d Maze (AKA Slot Racers) (1978) (Sears) [!] A26 m=2K;NTSC=true
sha1:05f8d0e9f9bec192dfe5947965039817c8c390df Maze (AKA Slot Racers) (1978) (Sears) [o1] A26 m=2K;NTSC=true
sha1:365a3af336d71f8f80345de9fcebb100f5141182 Maze 003 Demo (PD) A26 m=4K;NTSC=true
sha1:4a255c1d277f9ceb98dfe61ec2c6f7537ca4e7bf Maze Craze (1978) (Atari) (PAL) [!] A26 m=4K;PAL=true
sha1:aba25089d87cd6fee8d206b880baa5d938aae255 Maze Craze (1978) (Atari) A26 m=4K;NTSC=true
sha1:4a255c1d277f9ceb98dfe61ec2c6f7537ca4e7bf Maze Craze (1978) (Atari) (PAL) [!] A26 SP_FRAME=true;m=4K;PAL=true
sha1:aba25089d87cd6fee8d206b880baa5d938aae255 Maze Craze (1978) (Atari) A26 SP_FRAME=true;m=4K;NTSC=true
sha1:43c309177fde4adf59c99ba5d3865df2a588a79e Maze Demo 1 (PD) A26 m=4K;NTSC=true
sha1:648e91958afdf264e8e6b45521ecb542fb340586 Maze Demo 2 (PD) A26 m=4K;NTSC=true
sha1:0103b35b1aef6b10c1c0a44b213ebf30af708df6 McDonald's (1983) (Parker Bros) (Prototype) [!] A26 m=4K;NTSC=true
@ -1559,9 +1559,9 @@ sha1:03eb4a3b3db04c1782e1a91d27ea515163d258fb Oink! (CCE) A26 m=4K;NTSC=true
sha1:7feef3965706bc64f0f0a940149b2523e0735ce6 Okie Dokie (4K) (PD) A26 m=4K;NTSC=true
sha1:7bd1cbddefcf3bd24da570be015234d0c444a7e5 Okie Dokie (Older) (PD) A26 m=2K;NTSC=true
sha1:8a47b1930971f271a935c50d423e152aaea6ac59 Okie Dokie (PD) A26 m=2K;NTSC=true
sha1:ca4f26716120d2e4ba531c2ea50b570b9980756e Omega Race (1983) (CBS Electronics) [o1] A26 m=F6SC;NTSC=true
sha1:dcaab259e7617c7ac7d349893451896a9ca0e292 Omega Race (1983) (CBS Electronics) A26 m=FA;NTSC=true
sha1:c7a9ecad6c1a82048de54d33b231abd89fb08bd8 Omega Race JS (TJ) A26 m=FA;NTSC=true
sha1:ca4f26716120d2e4ba531c2ea50b570b9980756e Omega Race (1983) (CBS Electronics) [o1] A26 SP_RESET=true;m=F6SC;NTSC=true
sha1:dcaab259e7617c7ac7d349893451896a9ca0e292 Omega Race (1983) (CBS Electronics) A26 SP_RESET=true;m=FA;NTSC=true
sha1:c7a9ecad6c1a82048de54d33b231abd89fb08bd8 Omega Race JS (TJ) A26 SP_RESET=true;m=FA;NTSC=true
sha1:fbf180f8f35178099244bc1ae341ccff87838907 One Blue Bar Demo (PD) A26 m=4K;NTSC=true
sha1:e52ca6e73c931ef71c63e164704fb398086e4308 One On One by Angelino (Basketball Hack) A26 m=2K;NTSC=true
sha1:98007f26356b4032a2ae4e9fddea5a38a988eb13 Oscar's Trash Race (1983) (Atari) (PAL) [!] A26 m=F8;PAL=true
@ -2302,8 +2302,8 @@ sha1:7c2a2ddbdef639ed2985ce66ae717b2285a94ae0 Star Raiders (1982) (Atari) (PAL)
sha1:e10cce1a438c82bd499e1eb31a3f07d7254198f5 Star Raiders (1982) (Atari) A26 m=F8;NTSC=true
sha1:d2b6290afb81bad126321d923d222c26e2de5fa8 Star Ship - Outer Space (1977) [o1] A26 m=2K;NTSC=true
sha1:878e78ed46e29c44949d0904a2198826e412ed81 Star Ship - Outer Space (1977) A26 m=2K;NTSC=true
sha1:de05d1ca8ad1e7a85df3faf25b1aa90b159afded Star Strike (1982) (Mattel) A26 m=4K;NTSC=true
sha1:a0e29405a92773bf3baa2845788a8add8f3bc0b1 Star Strike (Telegames) (PAL) [!] A26 m=4K;PAL=true
sha1:de05d1ca8ad1e7a85df3faf25b1aa90b159afded Star Strike (1982) (Mattel) A26 SP_RESET=true;m=4K;NTSC=true
sha1:a0e29405a92773bf3baa2845788a8add8f3bc0b1 Star Strike (Telegames) (PAL) [!] A26 SP_RESET=true;m=4K;PAL=true
sha1:667a528e8cf3fd7f533cf67993f48bcc3c100e0d Star Trek - Strategic Operations Simulator (1983) (Sega) (PAL) [!] A26 m=F8;PAL=true
sha1:61a3ebbffa0bfb761295c66e189b62915f4818d9 Star Trek - Strategic Operations Simulator (1983) (Sega) A26 m=F8;NTSC=true
sha1:417bb89e1117413321ffba48a17e005b2687680b Star Voyager (1982) (CCE) [!] A26 m=4K;NTSC=true
@ -2554,8 +2554,8 @@ sha1:ccf422636180f24becaa8af0cc391f95e599a330 Tunnel Demo (28-03-2003) (AD) A26
sha1:0f6552a0afe40cc1c448313569db8c9a8cda6d21 Tunnel Demo (Cycling Colours 2) (29-03-2003) (AD) A26 m=4K;NTSC=true
sha1:8dad50a3918c7462811c2def42f289cd123822af Tunnel Demo (Red Spiral) (30-03-2003) (AD) A26 m=4K;NTSC=true
sha1:4df103678f9c88b017e64f1e14e741fc6e15340c Tunnel Demo 2 (27-03-2003) (CT) A26 m=4K;NTSC=true
sha1:fc1a0b58765a7dcbd8e33562e1074ddd9e0ac624 Tunnel Runner (1983) (CBS Electronics) [!] A26 m=FA;NTSC=true
sha1:460094d7689ac0c4435b72e3e390f4b6f2ef112c Tunnel Runner (1983) (CBS Electronics) [a1][!] A26 m=FA;NTSC=true
sha1:fc1a0b58765a7dcbd8e33562e1074ddd9e0ac624 Tunnel Runner (1983) (CBS Electronics) [!] A26 SP_RESET=true;m=FA;NTSC=true
sha1:460094d7689ac0c4435b72e3e390f4b6f2ef112c Tunnel Runner (1983) (CBS Electronics) [a1][!] A26 SP_RESET=true;m=FA;NTSC=true
sha1:0921fab66ce4b712701326ce105e1a84ac47b497 Turbo (Coleco) Prototype Fake v0.1 (TJ) A26 m=2K;NTSC=true
sha1:b594a9acedd4734070776bf69d0f08abb5c261bf Turbo WIP (TJ) A26 m=F8;NTSC=true
sha1:1162fe46977f01b4d25efab813e0d05ec90aeadc Turmoil (1982) (20th Century Fox) [!] A26 m=4K;NTSC=true
@ -2596,7 +2596,7 @@ sha1:082a7bc7d0fdbf307501cd146e18ed3d03b9ec0f Vertical Ship Demo 1 (PD) A26 m=
sha1:1d641abfb95e3b4b7abaad42a8760c8c9ce993a6 Vertically Scrolling Playfield (02-02-2003) (Aaron Bergstrom) A26 m=4K;NTSC=true
sha1:24c1c6e1a495137bec53818c2cd8bd83c8336d21 Video Checkers (1978) (Atari) (PAL) [!] A26 m=4K;PAL=true
sha1:babae88a832b76d8c5af6ea63b8f10a0da5bb992 Video Checkers (1978) (Atari) A26 m=4K;NTSC=true
sha1:043ef523e4fcb9fc2fc2fda21f15671bf8620fc3 Video Chess (1978) (Atari) A26 m=4K;NTSC=true
sha1:043ef523e4fcb9fc2fc2fda21f15671bf8620fc3 Video Chess (1978) (Atari) A26 SP_FRAME=true;m=4K;NTSC=true
sha1:3f2ad3666eb713b20484e3677d8e1cac8fbd323e Video Cube (CCE) A26 m=4K;NTSC=true
sha1:1554b146d076b64776bf49136cea01f60eeba4c1 Video Jogger (Exus) (PAL) A26 m=4K;PAL=true
sha1:19d4f52d399c2ab70e411be51b715341db7a41bf Video Life (CommaVid) [h1] A26 m=CV;NTSC=true
@ -2699,3 +2699,4 @@ sha1:00CCF622E7BA4D0A39DCBABAB771CE815B0FB8FE Boulder Dash (2005) (Andrew Davie
sha1:650DA2339D41D1D2F180A6CAFE8DC311AC588ACD Boulder Dash Intro Tune (2005) (Erik Ehrling) A26 m=4K;NTSC=true
sha1:F28E52921646A18467577370808454F494C15EFE 0840 EconoBanking A26 m=0840;NTSC=true
sha1:2A9647E27AB27E6CF82B3BF122EDF212FA34AE86 Halo2600 Final A26 m=m4K
sha1:341BB93E67C21063F3910845D1AF59FEA129FF21 Bang! A26 m=F4SC

View File

@ -0,0 +1,58 @@
;;;;;;;;;;--------------------------------------------------;;;;;;;;;;
;;; Type: NO-INTRO
;;; Source: Fairchild - Channel F - 20120223-000000
;;; FileGen: 2019-04-16 13:59:49 (UTC)
;;;;;;;;;;--------------------------------------------------;;;;;;;;;;
;;;;;;;;;;--------------------------------------------------;;;;;;;;;;
;;; Bad Dumps
;;;;;;;;;;--------------------------------------------------;;;;;;;;;;
;
;;;;;;;;;;--------------------------------------------------;;;;;;;;;;
;;; Hacks
;;;;;;;;;;--------------------------------------------------;;;;;;;;;;
;
;;;;;;;;;;--------------------------------------------------;;;;;;;;;;
;;; Over Dumps
;;;;;;;;;;--------------------------------------------------;;;;;;;;;;
;
;;;;;;;;;;--------------------------------------------------;;;;;;;;;;
;;; Translated
;;;;;;;;;;--------------------------------------------------;;;;;;;;;;
;
;;;;;;;;;;--------------------------------------------------;;;;;;;;;;
;;; Believed Good
;;;;;;;;;;--------------------------------------------------;;;;;;;;;;
F7BF7D55A7660FFA80D08AD1BA903FF7 Alien Invasion (USA) ChannelF USA
D89B48AE8C906488CAAC2B2AE1D63D88 Backgammon, Acey-Deucey (USA) ChannelF USA
4FA83F734C139963AA02BDBB7A52E500 Baseball (USA) ChannelF USA
25E231E7A464A32B4715BFB47AF89240 Bowling (USA) ChannelF USA
BB7F7BBBE21F142591CDCAFA98D7F6E4 Casino Poker (USA) ChannelF USA
35D61D40EF7EC337CBA092AABAC74DBD Checkers (USA) ChannelF USA
54CF17C48707467295749490D458EAFB Demonstration Cartridge (USA) ChannelF USA
F6916B665893AA8138CDE57C37E50ADA Demonstration Cartridge 2 (USA) ChannelF USA
4F11F13CBCA685CB20E888F87B3B1586 Desert Fox, Shooting Gallery (USA) ChannelF USA
6FFEDAED3C5CD8BA74D98901849CC451 Dodge It (USA) ChannelF USA
F80AF74B09D058B90E719BB7DFBDD50E Drag Race (USA) ChannelF USA
9E0711B140E22729687DB1E1354980AB Galactic Space Wars, Lunar Lander (USA) ChannelF USA
0124CD0B61DF5502AABD59029CCB6D5A Hangman (USA) ChannelF USA
4C10FA5C7316C59EFA241043FC67DFA8 Magic Numbers - Mind Reader + Nim (USA) ChannelF USA
A8E6103FCAE4D0F9E14D9EDCFC3FC493 Math Quiz I - Addition + Subtraction (USA) ChannelF USA
86B77EAFDF7B806E19E01724987E384F Math Quiz II - Multiplication + Division (USA) ChannelF USA
6565DF74539476D66FD78DE1BAC0259C Maze, Jailbreak, Blind-man's-bluff, Trailblazer (USA) ChannelF USA
53E4CC2DA0F2C167E0692B794CB7692C Maze, Jailbreak, Blind-man's-bluff, Trailblazer (USA) (Alt 1) ChannelF USA
2B3CA549E27579E4519A765FD8F52D0F Memory Match 1 & 2 (USA) ChannelF USA
1FBD86DCCA0E4619963B902C48AE77F2 Muehle, Tontauben-Schiessen, Kreatives Malspiel, Videoscope (Germany) ChannelF Germany
C2A44D22D3865B036479E9311C74D3AD Ordtaevling (Sweden) ChannelF Sweden
E90339B7068C6227D54F3C0CA637E017 Pinball Challenge (USA) ChannelF USA
5CBCDA1C44F0DAD02B0DFE209B6325D5 Pinball Challenge (USA) (Alt 1) ChannelF USA
9A894D745356A050F95410983C3BC54A Pro Football (USA) ChannelF USA
913ECBAA30816C6D78DE8651251761FC Rat' Mal (Germany) ChannelF Germany
3783B6AC359E21B99CFA17773AA811C6 Robot War, Torpedo Alley (USA) ChannelF USA
5568205F926333914DEDC8EF8BF16AF2 Schach (Germany) ChannelF Germany
DFB66EE145FAB65062FDEADAFC8DC34C Slot Machine (USA) ChannelF USA
4CB12EDAE37DF23851884B82CA410754 Sonar Search (USA) ChannelF USA
32CCA8FF09041A39251D7AADE21EE22F Space War (USA) ChannelF USA
1B409FE1154584F4D1AB76B344A73D99 Spitfire (USA) ChannelF USA
7E5C26A6D1F9A90C68669A9800BA522D Tic-Tac-Toe, Shooting Gallery, Doodle, Quadra-Doodle (USA) ChannelF USA
B074C867F235FB69CED96C6916673B45 Video Blackjack (USA) ChannelF USA
90A9B3952568F91502A7088BFB0AE07E Video Whizball (USA) ChannelF USA

View File

@ -0,0 +1,3 @@
SHA1:67F8513958C04E936B135740ED4EC6E6FA1763D5 Clean Sweep VEC
SHA1:38E38B5C60466146D4648F8929B5CE3A08DCBE0D Scramble VEC

View File

@ -103,7 +103,7 @@ namespace BizHawk.Client.ApiHawk
}
catch (NotImplementedException)
{
Console.WriteLine($"Error: {Emulator.Attributes().CoreName} does not yet implement disassemble()");
Console.WriteLine($"Error: {Emulator.Attributes().CoreName} does not yet implement {nameof(IDisassemblable.Disassemble)}()");
return null;
}
}
@ -124,7 +124,7 @@ namespace BizHawk.Client.ApiHawk
}
catch (NotImplementedException)
{
Console.WriteLine($"Error: {Emulator.Attributes().CoreName} does not yet implement getregister()");
Console.WriteLine($"Error: {Emulator.Attributes().CoreName} does not yet implement {nameof(IDebuggable.GetCpuFlagsAndRegisters)}()");
return null;
}
}
@ -147,7 +147,7 @@ namespace BizHawk.Client.ApiHawk
}
catch (NotImplementedException)
{
Console.WriteLine($"Error: {Emulator.Attributes().CoreName} does not yet implement getregisters()");
Console.WriteLine($"Error: {Emulator.Attributes().CoreName} does not yet implement {nameof(IDebuggable.GetCpuFlagsAndRegisters)}()");
}
return table;
@ -166,7 +166,7 @@ namespace BizHawk.Client.ApiHawk
}
catch (NotImplementedException)
{
Console.WriteLine($"Error: {Emulator.Attributes().CoreName} does not yet implement setregister()");
Console.WriteLine($"Error: {Emulator.Attributes().CoreName} does not yet implement {nameof(IDebuggable.SetCpuRegister)}()");
}
}
@ -183,7 +183,7 @@ namespace BizHawk.Client.ApiHawk
}
catch (NotImplementedException)
{
Console.WriteLine($"Error: {Emulator.Attributes().CoreName} does not yet implement totalexecutedcycles()");
Console.WriteLine($"Error: {Emulator.Attributes().CoreName} does not yet implement {nameof(IDebuggable.TotalExecutedCycles)}()");
return 0;
}
@ -201,7 +201,7 @@ namespace BizHawk.Client.ApiHawk
return InputPollableCore.IsLagFrame;
}
Console.WriteLine($"Can not get lag information, {Emulator.Attributes().CoreName} does not implement IInputPollable");
Console.WriteLine($"Can not get lag information, {Emulator.Attributes().CoreName} does not implement {nameof(IInputPollable)}");
return false;
}
@ -213,7 +213,7 @@ namespace BizHawk.Client.ApiHawk
}
else
{
Console.WriteLine($"Can not set lag information, {Emulator.Attributes().CoreName} does not implement IInputPollable");
Console.WriteLine($"Can not set lag information, {Emulator.Attributes().CoreName} does not implement {nameof(IInputPollable)}");
}
}
@ -224,7 +224,7 @@ namespace BizHawk.Client.ApiHawk
return InputPollableCore.LagCount;
}
Console.WriteLine($"Can not get lag information, {Emulator.Attributes().CoreName} does not implement IInputPollable");
Console.WriteLine($"Can not get lag information, {Emulator.Attributes().CoreName} does not implement {nameof(IInputPollable)}");
return 0;
}
@ -236,7 +236,7 @@ namespace BizHawk.Client.ApiHawk
}
else
{
Console.WriteLine($"Can not set lag information, {Emulator.Attributes().CoreName} does not implement IInputPollable");
Console.WriteLine($"Can not set lag information, {Emulator.Attributes().CoreName} does not implement {nameof(IInputPollable)}");
}
}

View File

@ -20,9 +20,9 @@ namespace BizHawk.Client.ApiHawk
{
buttons[button] = adaptor.IsPressed(button);
}
else if (button.Length >= 3 && button.Substring(0, 2) == "P" + controller)
else if (button.Length >= 3 && button.Substring(0, 2) == $"P{controller}")
{
buttons[button.Substring(3)] = adaptor.IsPressed("P" + controller + " " + button.Substring(3));
buttons[button.Substring(3)] = adaptor.IsPressed($"P{controller} {button.Substring(3)}");
}
}
@ -32,9 +32,9 @@ namespace BizHawk.Client.ApiHawk
{
buttons[button] = adaptor.GetFloat(button);
}
else if (button.Length >= 3 && button.Substring(0, 2) == "P" + controller)
else if (button.Length >= 3 && button.Substring(0, 2) == $"P{controller}")
{
buttons[button.Substring(3)] = adaptor.GetFloat("P" + controller + " " + button.Substring(3));
buttons[button.Substring(3)] = adaptor.GetFloat($"P{controller} {button.Substring(3)}");
}
}
@ -81,7 +81,7 @@ namespace BizHawk.Client.ApiHawk
}
catch (Exception)
{
Console.WriteLine("invalid mnemonic string: " + inputLogEntry);
Console.WriteLine($"invalid mnemonic string: {inputLogEntry}");
}
}
@ -119,7 +119,7 @@ namespace BizHawk.Client.ApiHawk
var toPress = button.ToString();
if (controller.HasValue)
{
toPress = "P" + controller + " " + button;
toPress = $"P{controller} {button}";
}
if (!invert)
@ -154,7 +154,7 @@ namespace BizHawk.Client.ApiHawk
var toPress = button;
if (controller.HasValue)
{
toPress = "P" + controller + " " + button;
toPress = $"P{controller} {button}";
}
if (state.HasValue)
Global.LuaAndAdaptor.SetButton(toPress, state.Value);
@ -191,7 +191,7 @@ namespace BizHawk.Client.ApiHawk
}
else
{
Global.StickyXORAdapter.SetFloat("P" + controller + " " + name, theValue);
Global.StickyXORAdapter.SetFloat($"P{controller} {name}", theValue);
}
}
}
@ -210,7 +210,7 @@ namespace BizHawk.Client.ApiHawk
}
else
{
Global.StickyXORAdapter.SetFloat("P" + controller + " " + control, value);
Global.StickyXORAdapter.SetFloat($"P{controller} {control}", value);
}
}
catch

View File

@ -64,7 +64,7 @@ namespace BizHawk.Client.ApiHawk
return d.PeekByte(addr);
}
Console.WriteLine("Warning: attempted read of " + addr + " outside the memory size of " + d.Size);
Console.WriteLine($"Warning: attempted read of {addr} outside the memory size of {d.Size}");
return 0;
}
@ -79,7 +79,7 @@ namespace BizHawk.Client.ApiHawk
}
else
{
Console.WriteLine("Warning: attempted write to " + addr + " outside the memory size of " + d.Size);
Console.WriteLine($"Warning: attempted write to {addr} outside the memory size of {d.Size}");
}
}
else
@ -165,8 +165,8 @@ namespace BizHawk.Client.ApiHawk
{
if (addr < d.Size)
list.Add(d.PeekByte(addr));
else {
Console.WriteLine("Warning: Attempted read " + addr + " outside memory domain size of " + d.Size + " in readbyterange()");
else {
Console.WriteLine($"Warning: Attempted read {addr} outside memory domain size of {d.Size} in {nameof(ReadByteRange)}()");
list.Add(0);
}
}
@ -187,7 +187,7 @@ namespace BizHawk.Client.ApiHawk
}
else
{
Console.WriteLine("Warning: Attempted write " + addr + " outside memory domain size of " + d.Size + " in writebyterange()");
Console.WriteLine($"Warning: Attempted write {addr} outside memory domain size of {d.Size} in {nameof(WriteByteRange)}()");
}
}
}
@ -207,7 +207,7 @@ namespace BizHawk.Client.ApiHawk
return BitConverter.ToSingle(bytes, 0);
}
Console.WriteLine("Warning: Attempted read " + addr + " outside memory size of " + d.Size);
Console.WriteLine($"Warning: Attempted read {addr} outside memory size of {d.Size}");
return 0;
}
@ -226,7 +226,7 @@ namespace BizHawk.Client.ApiHawk
}
else
{
Console.WriteLine("Warning: Attempted write " + addr + " outside memory size of " + d.Size);
Console.WriteLine($"Warning: Attempted write {addr} outside memory size of {d.Size}");
}
}
else

View File

@ -169,7 +169,7 @@ namespace BizHawk.Client.ApiHawk
if (!string.IsNullOrEmpty(filename))
{
filename += "." + Global.MovieSession.Movie.PreferredExtension;
filename += $".{Global.MovieSession.Movie.PreferredExtension}";
var test = new FileInfo(filename);
if (test.Exists)
{

View File

@ -87,7 +87,7 @@ namespace BizHawk.Client.ApiHawk
{
var table = new Dictionary<string, object>();
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;
@ -101,7 +101,7 @@ namespace BizHawk.Client.ApiHawk
{
for (int i = 0; i < reader.FieldCount; ++i)
{
table[columns[i] + " " + rowCount.ToString()] = reader.GetValue(i);
table[$"{columns[i]} {rowCount}"] = reader.GetValue(i);
}
rowCount += 1;
}

View File

@ -93,6 +93,9 @@ namespace BizHawk.Client.ApiHawk
case "TI83":
return CoreSystem.TI83;
case "VEC":
return CoreSystem.Vectrex;
case "WSWAN":
return CoreSystem.WonderSwan;
@ -102,6 +105,12 @@ namespace BizHawk.Client.ApiHawk
case "AmstradCPC":
return CoreSystem.AmstradCPC;
case "GGL":
return CoreSystem.GGL;
case "ChannelF":
return CoreSystem.ChannelF;
case "VB":
case "NGP":
case "DNGP":
@ -112,7 +121,7 @@ namespace BizHawk.Client.ApiHawk
return 0; // like I give a shit
default:
throw new IndexOutOfRangeException(string.Format("{0} is missing in convert list", value));
throw new IndexOutOfRangeException($"{value} is missing in convert list");
}
}
@ -218,7 +227,7 @@ namespace BizHawk.Client.ApiHawk
return "AmstradCPC";
default:
throw new IndexOutOfRangeException(string.Format("{0} is missing in convert list", value.ToString()));
throw new IndexOutOfRangeException($"{value.ToString()} is missing in convert list");
}
}

View File

@ -97,7 +97,9 @@ namespace BizHawk.Client.ApiHawk
method = mainFormClass.GetMethod(name, typeList.ToArray());
}
else method = mainFormClass.GetMethod(name);
method.Invoke(clientMainFormInstance, paramList);
if(method != null)
method.Invoke(clientMainFormInstance, paramList);
}
private static object GetMainFormField(string name)
@ -145,7 +147,7 @@ namespace BizHawk.Client.ApiHawk
{
if (player < 1 || player > RunningSystem.MaxControllers)
{
throw new IndexOutOfRangeException(string.Format("{0} does not support {1} controller(s)", RunningSystem.DisplayName, player));
throw new IndexOutOfRangeException($"{RunningSystem.DisplayName} does not support {player} controller(s)");
}
else
{
@ -161,7 +163,7 @@ namespace BizHawk.Client.ApiHawk
/// <param name="name">Savetate friendly name</param>
public static void LoadState(string name)
{
InvokeMainFormMethod("LoadState", new object[] { Path.Combine(PathManager.GetSaveStatePath(Global.Game), string.Format("{0}.{1}", name, "State")), name, false, false });
InvokeMainFormMethod("LoadState", new object[] { Path.Combine(PathManager.GetSaveStatePath(Global.Game), $"{name}.{"State"}"), name, false, false });
}
@ -250,7 +252,7 @@ namespace BizHawk.Client.ApiHawk
/// <param name="name">Savetate friendly name</param>
public static void SaveState(string name)
{
InvokeMainFormMethod("SaveState", new object[] { Path.Combine(PathManager.GetSaveStatePath(Global.Game), string.Format("{0}.{1}", name, "State")), name, false });
InvokeMainFormMethod("SaveState", new object[] { Path.Combine(PathManager.GetSaveStatePath(Global.Game), $"{name}.{"State"}"), name, false });
}
/// <summary>
@ -358,7 +360,7 @@ namespace BizHawk.Client.ApiHawk
{
if (player < 1 || player > RunningSystem.MaxControllers)
{
throw new IndexOutOfRangeException(string.Format("{0} does not support {1} controller(s)", RunningSystem.DisplayName, player));
throw new IndexOutOfRangeException($"{RunningSystem.DisplayName} does not support {player} controller(s)");
}
else
{
@ -376,11 +378,11 @@ namespace BizHawk.Client.ApiHawk
AutoFireStickyXorAdapter joypadAdaptor = Global.AutofireStickyXORAdapter;
if (RunningSystem == SystemInfo.GB)
{
joypadAdaptor.SetSticky(string.Format("{0}", JoypadConverter.ConvertBack(button, RunningSystem)), true);
joypadAdaptor.SetSticky($"{JoypadConverter.ConvertBack(button, RunningSystem)}", true);
}
else
{
joypadAdaptor.SetSticky(string.Format("P{0} {1}", player, JoypadConverter.ConvertBack(button, RunningSystem)), true);
joypadAdaptor.SetSticky($"P{player} {JoypadConverter.ConvertBack(button, RunningSystem)}", true);
}
}
}
@ -392,8 +394,8 @@ namespace BizHawk.Client.ApiHawk
AutoFireStickyXorAdapter joypadAdaptor = Global.AutofireStickyXORAdapter;
for (int i = 1; i <= RunningSystem.MaxControllers; i++)
{
joypadAdaptor.SetFloat(string.Format("P{0} X Axis", i), allJoypads[i - 1].AnalogX);
joypadAdaptor.SetFloat(string.Format("P{0} Y Axis", i), allJoypads[i - 1].AnalogY);
joypadAdaptor.SetFloat($"P{i} X Axis", allJoypads[i - 1].AnalogX);
joypadAdaptor.SetFloat($"P{i} Y Axis", allJoypads[i - 1].AnalogY);
}
}*/
}
@ -446,8 +448,8 @@ namespace BizHawk.Client.ApiHawk
{
for (int i = 1; i <= RunningSystem.MaxControllers; i++)
{
allJoypads[i - 1].AnalogX = joypadAdaptor.GetFloat(string.Format("P{0} X Axis", i));
allJoypads[i - 1].AnalogY = joypadAdaptor.GetFloat(string.Format("P{0} Y Axis", i));
allJoypads[i - 1].AnalogX = joypadAdaptor.GetFloat($"P{i} X Axis");
allJoypads[i - 1].AnalogY = joypadAdaptor.GetFloat($"P{i} Y Axis");
}
}
}
@ -650,7 +652,7 @@ namespace BizHawk.Client.ApiHawk
object osd = f.GetValue(null);
t = f.GetType();
MethodInfo m = t.GetMethod("AddMessage");
m.Invoke(osd, new Object[] { "Window size set to " + size + "x" });
m.Invoke(osd, new Object[] { $"Window size set to {size}x" });
}
else
{

View File

@ -94,7 +94,7 @@ namespace BizHawk.Client.ApiHawk
item.ToolTipText = attribute.Description;
if (attribute.IconResourceName != "")
{
Stream s = externalToolFile.GetManifestResourceStream(string.Format("{0}.{1}", externalToolFile.GetName().Name, attribute.IconResourceName));
Stream s = externalToolFile.GetManifestResourceStream($"{externalToolFile.GetName().Name}.{attribute.IconResourceName}");
if (s != null)
{
item.Image = new Bitmap(s);

View File

@ -29,7 +29,7 @@ namespace BizHawk.Client.ApiHawk
{
if (player < 1 || player > system.MaxControllers)
{
throw new InvalidOperationException(string.Format("{0} is invalid for {1}", player, system.DisplayName));
throw new InvalidOperationException($"{player} is invalid for {system.DisplayName}");
}
_System = system;

View File

@ -91,7 +91,7 @@ namespace BizHawk.Client.ApiHawk
return JoypadButton.R;
default:
throw new IndexOutOfRangeException(string.Format("{0} is missing in convert list", value));
throw new IndexOutOfRangeException($"{value} is missing in convert list");
}
}
@ -210,7 +210,7 @@ namespace BizHawk.Client.ApiHawk
return "R";
default:
throw new IndexOutOfRangeException(string.Format("{0} is missing in convert list", value));
throw new IndexOutOfRangeException($"{value} is missing in convert list");
}
}

View File

@ -13,7 +13,7 @@
#region MemoryMappedFiles
void MmfSetFilename(string filename);
string MmfSetFilename();
string MmfGetFilename();
int MmfScreenshot();
int MmfWrite(string mmf_filename, string outputString);
string MmfRead(string mmf_filename, int expectedSize);

View File

@ -89,7 +89,7 @@ namespace SevenZip
// private static string _LibraryVersion;
private static bool? _modifyCapabale;
private static readonly PlatformLinkedLibSingleton.PlatformLinkedLibManager libLoader = PlatformLinkedLibSingleton.LinkedLibManager;
private static readonly OSTailoredCode.ILinkedLibManager libLoader = OSTailoredCode.LinkedLibManager;
private static void InitUserInFormat(object user, InArchiveFormat format)
{

View File

@ -29,8 +29,11 @@
WonderSwan,
Libretro,
VirtualBoy,
Vectrex,
NeoGeoPocket,
ZXSpectrum,
AmstradCPC
AmstradCPC,
GGL,
ChannelF
}
}

View File

@ -260,7 +260,7 @@ namespace BizHawk.Client.Common
if (abort)
{
throw new Exception("Essential zip section not found: " + lump.ReadName);
throw new Exception($"Essential zip section not found: {lump.ReadName}");
}
return false;

View File

@ -53,7 +53,7 @@ namespace BizHawk.Client.Common
{
if (required)
{
var fullmsg = $"Couldn't find required firmware \"{sysID}:{firmwareID}\". This is fatal{(msg != null ? ": " + msg : ".")}";
var fullmsg = $"Couldn't find required firmware \"{sysID}:{firmwareID}\". This is fatal{(msg != null ? $": {msg}" : ".")}";
throw new MissingFirmwareException(fullmsg);
}

View File

@ -154,6 +154,8 @@ namespace BizHawk.Client.Common
return SystemInfo.ZXSpectrum;
case "AmstradCPC":
return SystemInfo.AmstradCPC;
case "ChannelF":
return SystemInfo.ChannelF;
}
}
}

View File

@ -60,7 +60,7 @@ namespace BizHawk.Client.Common
else if (type == OpenAdvancedTypes.LibretroNoGame) ioa = new OpenAdvanced_LibretroNoGame();
else ioa = null;
if (ioa == null)
throw new InvalidOperationException("IOpenAdvanced deserialization error");
throw new InvalidOperationException($"{nameof(IOpenAdvanced)} deserialization error");
ioa.Deserialize(token);
return ioa;
}
@ -87,7 +87,7 @@ namespace BizHawk.Client.Common
public Token token = new Token();
public string TypeName { get { return "Libretro"; } }
public string DisplayName { get { return string.Format("{0}:{1}", Path.GetFileNameWithoutExtension(token.CorePath), token.Path); } }
public string DisplayName { get { return $"{Path.GetFileNameWithoutExtension(token.CorePath)}:{token.Path}"; } }
public string SimplePath { get { return token.Path; } }
public void Deserialize(string str)

View File

@ -34,7 +34,7 @@ namespace BizHawk.Client.Common
/// </summary>
public static string MakeProgramRelativePath(string path)
{
return MakeAbsolutePath("%exe%/" + path, null);
return MakeAbsolutePath($"%exe%/{path}", null);
}
public static string GetDllDirectory()
@ -262,13 +262,13 @@ namespace BizHawk.Client.Common
var name = FilesystemSafeName(game);
if (Global.MovieSession.Movie.IsActive)
{
name += "." + Path.GetFileNameWithoutExtension(Global.MovieSession.Movie.Filename);
name += $".{Path.GetFileNameWithoutExtension(Global.MovieSession.Movie.Filename)}";
}
var pathEntry = Global.Config.PathEntries[game.System, "Save RAM"] ??
Global.Config.PathEntries[game.System, "Base"];
return Path.Combine(MakeAbsolutePath(pathEntry.Path, game.System), name) + ".SaveRAM";
return $"{Path.Combine(MakeAbsolutePath(pathEntry.Path, game.System), name)}.SaveRAM";
}
public static string AutoSaveRamPath(GameInfo game)
@ -289,7 +289,7 @@ namespace BizHawk.Client.Common
if (Global.MovieSession.Movie.IsActive)
{
name = Path.Combine(name, "movie-" + Path.GetFileNameWithoutExtension(Global.MovieSession.Movie.Filename));
name = Path.Combine(name, $"movie-{Path.GetFileNameWithoutExtension(Global.MovieSession.Movie.Filename)}");
}
var pathEntry = Global.Config.PathEntries[game.System, "Save RAM"] ??
@ -337,34 +337,34 @@ namespace BizHawk.Client.Common
// Neshawk and Quicknes have incompatible savestates, store the name to keep them separate
if (Global.Emulator.SystemId == "NES")
{
name += "." + Global.Emulator.Attributes().CoreName;
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;
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;
name += $".{Global.Emulator.Attributes().CoreName}";
}
// Bsnes profiles have incompatible savestates so save the profile name
if (Global.Emulator is LibsnesCore)
{
name += "." + (Global.Emulator as LibsnesCore).CurrentProfile;
name += $".{((LibsnesCore)Global.Emulator).CurrentProfile}";
}
if (Global.Emulator.SystemId == "GBA")
{
name += "." + Global.Emulator.Attributes().CoreName;
name += $".{Global.Emulator.Attributes().CoreName}";
}
if (Global.MovieSession.Movie.IsActive)
{
name += "." + Path.GetFileNameWithoutExtension(Global.MovieSession.Movie.Filename);
name += $".{Path.GetFileNameWithoutExtension(Global.MovieSession.Movie.Filename)}";
}
var pathEntry = Global.Config.PathEntries[game.System, "Savestates"] ??

View File

@ -17,6 +17,7 @@ using BizHawk.Emulation.Cores.Nintendo.GBHawk;
using BizHawk.Emulation.Cores.Nintendo.GBHawkLink;
using BizHawk.Emulation.Cores.Nintendo.SNES;
using BizHawk.Emulation.Cores.PCEngine;
using BizHawk.Emulation.Cores.Sega.GGHawkLink;
using BizHawk.Emulation.Cores.Sega.Saturn;
using BizHawk.Emulation.Cores.Sony.PSP;
using BizHawk.Emulation.Cores.Sony.PSX;
@ -27,6 +28,8 @@ using GPGX64 = BizHawk.Emulation.Cores.Consoles.Sega.gpgx;
using BizHawk.Emulation.Cores.Consoles.Sega.Saturn;
using BizHawk.Emulation.Cores.Consoles.NEC.PCFX;
using BizHawk.Emulation.Cores.Computers.AmstradCPC;
using BizHawk.Emulation.Cores.Consoles.Vectrex;
using BizHawk.Emulation.Cores.Consoles.ChannelF;
namespace BizHawk.Client.Common
{
@ -218,7 +221,7 @@ namespace BizHawk.Client.Common
else if (discMountJob.OUT_ErrorLevel)
{
throw new InvalidOperationException("\r\n" + discMountJob.OUT_Log);
throw new InvalidOperationException($"\r\n{discMountJob.OUT_Log}");
}
else if (disc == null)
@ -427,7 +430,7 @@ namespace BizHawk.Client.Common
if (discMountJob.OUT_ErrorLevel)
{
throw new InvalidOperationException("\r\n" + discMountJob.OUT_Log);
throw new InvalidOperationException($"\r\n{discMountJob.OUT_Log}");
}
if (disc == null)
@ -495,7 +498,7 @@ namespace BizHawk.Client.Common
if (discMountJob.OUT_ErrorLevel)
{
throw new InvalidOperationException("\r\n" + discMountJob.OUT_Log);
throw new InvalidOperationException($"\r\n{discMountJob.OUT_Log}");
}
var disc = discMountJob.OUT_Disc;
@ -728,7 +731,7 @@ namespace BizHawk.Client.Common
if (discMountJob.OUT_ErrorLevel)
{
throw new InvalidOperationException("\r\n" + discMountJob.OUT_Log);
throw new InvalidOperationException($"\r\n{discMountJob.OUT_Log}");
}
if (disc == null)
@ -805,6 +808,22 @@ namespace BizHawk.Client.Common
}
nextEmulator = new GPGX(nextComm, null, genDiscs, GetCoreSettings<GPGX>(), GetCoreSyncSettings<GPGX>());
break;
case "Game Gear":
var leftBytesGG = xmlGame.Assets.First().Value;
var rightBytesGG = xmlGame.Assets.Skip(1).First().Value;
var leftGG = Database.GetGameInfo(leftBytesGG, "left.gg");
var rightGG = Database.GetGameInfo(rightBytesGG, "right.gg");
nextEmulator = new GGHawkLink(
nextComm,
leftGG,
leftBytesGG,
rightGG,
rightBytesGG,
GetCoreSettings<GGHawkLink>(),
GetCoreSyncSettings<GGHawkLink>());
break;
default:
return false;
}
@ -1061,6 +1080,9 @@ namespace BizHawk.Client.Common
Deterministic);
nextEmulator = zx;
break;
case "ChannelF":
nextEmulator = new ChannelF(nextComm, game, rom.FileData, GetCoreSettings<ChannelF>(), GetCoreSyncSettings<ChannelF>());
break;
case "AmstradCPC":
var cpc = new AmstradCPC(nextComm, Enumerable.Repeat(rom.RomData, 1), Enumerable.Repeat(rom.GameInfo, 1).ToList(), GetCoreSettings<AmstradCPC>(), GetCoreSyncSettings<AmstradCPC>());
nextEmulator = cpc;
@ -1154,12 +1176,12 @@ namespace BizHawk.Client.Common
// handle exceptions thrown by the new detected systems that bizhawk does not have cores for
else if (ex is NoAvailableCoreException)
{
DoLoadErrorCallback(ex.Message + "\n\n" + ex, system);
DoLoadErrorCallback($"{ex.Message}\n\n{ex}", system);
}
else
{
DoLoadErrorCallback("A core accepted the rom, but threw an exception while loading it:\n\n" + ex, system);
DoLoadErrorCallback($"A core accepted the rom, but threw an exception while loading it:\n\n{ex}", system);
}
return false;

View File

@ -29,8 +29,7 @@ namespace BizHawk.Client.Common
for (int i = 0; i < 10; i++)
{
var file = new FileInfo(
PathManager.SaveStatePrefix(Global.Game) + "." + "QuickSave" + i + ".State");
var file = new FileInfo($"{PathManager.SaveStatePrefix(Global.Game)}.QuickSave{i}.State");
if (file.Directory != null && file.Directory.Exists == false)
{
file.Directory.Create();
@ -108,8 +107,8 @@ namespace BizHawk.Client.Common
{
// Takes the .state and .bak files and swaps them
var state = new FileInfo(path);
var backup = new FileInfo(path + ".bak");
var temp = new FileInfo(path + ".bak.tmp");
var backup = new FileInfo($"{path}.bak");
var temp = new FileInfo($"{path}.bak.tmp");
if (!state.Exists || !backup.Exists)
{
@ -121,9 +120,9 @@ namespace BizHawk.Client.Common
temp.Delete();
}
backup.CopyTo(path + ".bak.tmp");
backup.CopyTo($"{path}.bak.tmp");
backup.Delete();
state.CopyTo(path + ".bak");
state.CopyTo($"{path}.bak");
state.Delete();
temp.CopyTo(path);
temp.Delete();

View File

@ -183,6 +183,11 @@ namespace BizHawk.Client.Common
/// </summary>
public static SystemInfo VirtualBoy { get; } = new SystemInfo("Virtual Boy", CoreSystem.VirtualBoy, 1);
/// <summary>
/// Gets the <see cref="SystemInfo"/> instance for Vectrex
/// </summary>
public static SystemInfo Vectrex { get; } = new SystemInfo("Vextrex", CoreSystem.Vectrex, 2);
/// <summary>
/// Gets the <see cref="SystemInfo"/> instance for TI-83
/// </summary>
@ -198,14 +203,24 @@ namespace BizHawk.Client.Common
/// </summary>
public static SystemInfo AmstradCPC { get; } = new SystemInfo("Amstrad CPC", CoreSystem.AmstradCPC, 2);
#endregion Get SystemInfo
/// <summary>
/// Gets the <see cref="SystemInfo"/> instance for GGL
/// </summary>
public static SystemInfo GGL { get; } = new SystemInfo("Game Gear Linked", CoreSystem.GGL, 2);
/// <summary>
/// Get a <see cref="SystemInfo"/> by its <see cref="CoreSystem"/>
/// </summary>
/// <param name="system"><see cref="CoreSystem"/> you're looking for</param>
/// <returns><see cref="SystemInfo"/></returns>
public static SystemInfo FindByCoreSystem(CoreSystem system)
/// <summary>
/// Gets the <see cref="SystemInfo"/> instance for ChannelF
/// </summary>
public static SystemInfo ChannelF { get; } = new SystemInfo("Channel F", CoreSystem.ChannelF, 2);
#endregion Get SystemInfo
/// <summary>
/// Get a <see cref="SystemInfo"/> by its <see cref="CoreSystem"/>
/// </summary>
/// <param name="system"><see cref="CoreSystem"/> you're looking for</param>
/// <returns><see cref="SystemInfo"/></returns>
public static SystemInfo FindByCoreSystem(CoreSystem system)
{
return _allSystemInfos.Find(s => s.System == system);
}

View File

@ -69,7 +69,7 @@ namespace BizHawk.Client.Common
}
else
{
throw new Exception("Couldn't load XMLGame Asset \"" + filename + "\"");
throw new Exception($"Couldn't load XMLGame Asset \"{filename}\"");
}
}
else
@ -98,7 +98,7 @@ namespace BizHawk.Client.Common
}
catch
{
throw new Exception("Couldn't load XMLGame LoadAsset \"" + filename + "\"");
throw new Exception($"Couldn't load XMLGame LoadAsset \"{filename}\"");
}
}

View File

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Drawing;
using BizHawk.Common;
using BizHawk.Emulation.Common;
// ReSharper disable FieldCanBeMadeReadOnly.Global
@ -341,8 +342,13 @@ namespace BizHawk.Client.Common
public int DispPrescale = 1;
// warning: we dont even want to deal with changing this at runtime. but we want it changed here for config purposes. so dont check this variable. check in GlobalWin or something like that.
public EDispMethod DispMethod = EDispMethod.SlimDX9;
/// <remarks>
/// warning: we dont even want to deal with changing this at runtime. but we want it changed here for config purposes. so dont check this variable. check in GlobalWin or something like that.
/// force DX for Windows and GDI+ for Unix when a new config is generated
/// </remarks>
public EDispMethod DispMethod = OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows
? EDispMethod.SlimDX9
: EDispMethod.GdiPlus;
public int DispChrome_FrameWindowed = 2;
public bool DispChrome_StatusBarWindowed = true;
@ -370,11 +376,9 @@ namespace BizHawk.Client.Common
public int DispCropBottom = 0;
// Sound options
#if WINDOWS
public ESoundOutputMethod SoundOutputMethod = ESoundOutputMethod.DirectSound;
#else
public ESoundOutputMethod SoundOutputMethod = ESoundOutputMethod.OpenAL;
#endif
public ESoundOutputMethod SoundOutputMethod = OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows
? ESoundOutputMethod.DirectSound
: ESoundOutputMethod.OpenAL; // force OpenAL for Unix when config is generated
public bool SoundEnabled = true;
public bool SoundEnabledNormal = true;
public bool SoundEnabledRWFF = true;

View File

@ -73,8 +73,8 @@ namespace BizHawk.Client.Common
}
// we don't have anything for the system in question. add a set of stock paths
var systempath = PathManager.RemoveInvalidFileSystemChars(system) + "_INTERIM";
var systemdisp = system + " (INTERIM)";
var systempath = $"{PathManager.RemoveInvalidFileSystemChars(system)}_INTERIM";
var systemdisp = $"{system} (INTERIM)";
Paths.AddRange(new[]
{
@ -382,6 +382,12 @@ namespace BizHawk.Client.Common
new PathEntry { System = "PCFX", SystemDisplayName = "PCFX", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
new PathEntry { System = "PCFX", SystemDisplayName = "PCFX", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry { System = "PCFX", SystemDisplayName = "PCFX", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
new PathEntry { System = "ChannelF", SystemDisplayName = "Fairchild Channel F", Type = "Base", Path = Path.Combine(".", "ZXSpectrum"), Ordinal = 0 },
new PathEntry { System = "ChannelF", SystemDisplayName = "Fairchild Channel F", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry { System = "ChannelF", SystemDisplayName = "Fairchild Channel F", Type = "Savestates", Path = Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry { System = "ChannelF", SystemDisplayName = "Fairchild Channel F", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry { System = "ChannelF", SystemDisplayName = "Fairchild Channel F", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
};
}
}

View File

@ -79,7 +79,7 @@ namespace BizHawk.Client.Common
return new Point(_wndx.Value, _wndy.Value);
}
throw new InvalidOperationException("TopLeft can not be used when one of the coordinates is null");
throw new InvalidOperationException($"{nameof(TopLeft)} can not be used when one of the coordinates is null");
}
}

View File

@ -32,7 +32,7 @@ namespace BizHawk.Client.Common
}
prefix = button.GetPrecedingString("Down");
string other = prefix + "Up";
string other = $"{prefix}Up";
if (Source.IsPressed(other))
{
if (_unpresses.Contains(button))
@ -61,7 +61,7 @@ namespace BizHawk.Client.Common
}
prefix = button.GetPrecedingString("Up");
string other = prefix + "Down";
string other = $"{prefix}Down";
if (Source.IsPressed(other))
{
if (_unpresses.Contains(button))
@ -90,7 +90,7 @@ namespace BizHawk.Client.Common
}
prefix = button.GetPrecedingString("Right");
string other = prefix + "Left";
string other = $"{prefix}Left";
if (Source.IsPressed(other))
{
if (_unpresses.Contains(button))
@ -119,7 +119,7 @@ namespace BizHawk.Client.Common
}
prefix = button.GetPrecedingString("Left");
string other = prefix + "Right";
string other = $"{prefix}Right";
if (Source.IsPressed(other))
{
if (_unpresses.Contains(button))

View File

@ -93,7 +93,7 @@ namespace BizHawk.Client.Common
}
catch (NotImplementedException)
{
Log($"Error: {Emulator.Attributes().CoreName} does not yet implement disassemble()");
Log($"Error: {Emulator.Attributes().CoreName} does not yet implement {nameof(IDisassemblable.Disassemble)}()");
return null;
}
}
@ -117,7 +117,7 @@ namespace BizHawk.Client.Common
}
catch (NotImplementedException)
{
Log($"Error: {Emulator.Attributes().CoreName} does not yet implement getregister()");
Log($"Error: {Emulator.Attributes().CoreName} does not yet implement {nameof(IDebuggable.GetCpuFlagsAndRegisters)}()");
return 0;
}
}
@ -142,7 +142,7 @@ namespace BizHawk.Client.Common
}
catch (NotImplementedException)
{
Log($"Error: {Emulator.Attributes().CoreName} does not yet implement getregisters()");
Log($"Error: {Emulator.Attributes().CoreName} does not yet implement {nameof(IDebuggable.GetCpuFlagsAndRegisters)}()");
}
return table;
@ -163,7 +163,7 @@ namespace BizHawk.Client.Common
}
catch (NotImplementedException)
{
Log($"Error: {Emulator.Attributes().CoreName} does not yet implement setregister()");
Log($"Error: {Emulator.Attributes().CoreName} does not yet implement {nameof(IDebuggable.SetCpuRegister)}()");
}
}
@ -182,7 +182,7 @@ namespace BizHawk.Client.Common
}
catch (NotImplementedException)
{
Log($"Error: {Emulator.Attributes().CoreName} does not yet implement totalexecutedcycles()");
Log($"Error: {Emulator.Attributes().CoreName} does not yet implement {nameof(IDebuggable.TotalExecutedCycles)}()");
return 0;
}
@ -204,7 +204,7 @@ namespace BizHawk.Client.Common
return InputPollableCore.IsLagFrame;
}
Log($"Can not get lag information, {Emulator.Attributes().CoreName} does not implement IInputPollable");
Log($"Can not get lag information, {Emulator.Attributes().CoreName} does not implement {nameof(IInputPollable)}");
return false;
}
@ -218,7 +218,7 @@ namespace BizHawk.Client.Common
}
else
{
Log($"Can not set lag information, {Emulator.Attributes().CoreName} does not implement IInputPollable");
Log($"Can not set lag information, {Emulator.Attributes().CoreName} does not implement {nameof(IInputPollable)}");
}
}
@ -231,7 +231,7 @@ namespace BizHawk.Client.Common
return InputPollableCore.LagCount;
}
Log($"Can not get lag information, {Emulator.Attributes().CoreName} does not implement IInputPollable");
Log($"Can not get lag information, {Emulator.Attributes().CoreName} does not implement {nameof(IInputPollable)}");
return 0;
}
@ -245,7 +245,7 @@ namespace BizHawk.Client.Common
}
else
{
Log($"Can not set lag information, {Emulator.Attributes().CoreName} does not implement IInputPollable");
Log($"Can not set lag information, {Emulator.Attributes().CoreName} does not implement {nameof(IInputPollable)}");
}
}

View File

@ -62,10 +62,7 @@ namespace BizHawk.Client.Common
}
catch (Exception e)
{
Log(
"error running function attached by lua function event.onsavestate" +
"\nError message: " +
e.Message);
Log($"error running function attached by lua function event.onsavestate\nError message: {e.Message}");
}
}
}
@ -84,10 +81,7 @@ namespace BizHawk.Client.Common
}
catch (Exception e)
{
Log(
"error running function attached by lua function event.onloadstate" +
"\nError message: " +
e.Message);
Log($"error running function attached by lua function event.onloadstate\nError message: {e.Message}");
}
}
}
@ -106,10 +100,7 @@ namespace BizHawk.Client.Common
}
catch (Exception e)
{
Log(
"error running function attached by lua function event.onframestart" +
"\nError message: " +
e.Message);
Log($"error running function attached by lua function event.onframestart\nError message: {e.Message}");
}
}
}
@ -128,10 +119,7 @@ namespace BizHawk.Client.Common
}
catch (Exception e)
{
Log(
"error running function attached by lua function event.onframeend" +
"\nError message: " +
e.Message);
Log($"error running function attached by lua function event.onframeend\nError message: {e.Message}");
}
}
}

View File

@ -25,9 +25,9 @@ namespace BizHawk.Client.Common
{
buttons[button] = adaptor.IsPressed(button);
}
else if (button.Length >= 3 && button.Substring(0, 2) == "P" + controller)
else if (button.Length >= 3 && button.Substring(0, 2) == $"P{controller}")
{
buttons[button.Substring(3)] = adaptor.IsPressed("P" + controller + " " + button.Substring(3));
buttons[button.Substring(3)] = adaptor.IsPressed($"P{controller} {button.Substring(3)}");
}
}
@ -37,9 +37,9 @@ namespace BizHawk.Client.Common
{
buttons[button] = adaptor.GetFloat(button);
}
else if (button.Length >= 3 && button.Substring(0, 2) == "P" + controller)
else if (button.Length >= 3 && button.Substring(0, 2) == $"P{controller}")
{
buttons[button.Substring(3)] = adaptor.GetFloat("P" + controller + " " + button.Substring(3));
buttons[button.Substring(3)] = adaptor.GetFloat($"P{controller} {button.Substring(3)}");
}
}
@ -85,7 +85,7 @@ namespace BizHawk.Client.Common
}
catch (Exception)
{
Log("invalid mnemonic string: " + inputLogEntry);
Log($"invalid mnemonic string: {inputLogEntry}");
}
}
@ -125,7 +125,7 @@ namespace BizHawk.Client.Common
var toPress = button.ToString();
if (controller.HasValue)
{
toPress = "P" + controller + " " + button;
toPress = $"P{controller} {button}";
}
if (!invert)
@ -180,7 +180,7 @@ namespace BizHawk.Client.Common
}
else
{
Global.StickyXORAdapter.SetFloat("P" + controller + " " + name, theValue);
Global.StickyXORAdapter.SetFloat($"P{controller} {name}", theValue);
}
}
}

View File

@ -149,7 +149,7 @@ namespace BizHawk.Client.Common
if (!string.IsNullOrEmpty(filename))
{
filename += "." + Global.MovieSession.Movie.PreferredExtension;
filename += $".{Global.MovieSession.Movie.PreferredExtension}";
var test = new FileInfo(filename);
if (test.Exists)
{

View File

@ -105,7 +105,7 @@ 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;
@ -119,7 +119,7 @@ namespace BizHawk.Client.Common
{
for (int i = 0; i < reader.FieldCount; ++i)
{
table[columns[i] + " " + rowCount.ToString()] = reader.GetValue(i);
table[$"{columns[i]} {rowCount}"] = reader.GetValue(i);
}
rowCount += 1;
}

View File

@ -24,7 +24,7 @@ namespace BizHawk.Client.Common
var hex = $"{num:X}";
if (hex.Length == 1)
{
hex = "0" + hex;
hex = $"0{hex}";
}
return hex;
@ -46,7 +46,7 @@ namespace BizHawk.Client.Common
var octal = Convert.ToString(num, 8);
if (octal.Length == 1)
{
octal = "0" + octal;
octal = $"0{octal}";
}
return octal;

View File

@ -102,7 +102,7 @@ __Types and notation__
{
var completion = new SublimeCompletions.Completion
{
Trigger = f.Library + "." + f.Name
Trigger = $"{f.Library}.{f.Name}"
};
var sb = new StringBuilder();

View File

@ -101,7 +101,7 @@ namespace BizHawk.Client.Common
foreach (var method in methods)
{
var luaMethodAttr = (LuaMethodAttribute)method.GetCustomAttributes(luaAttr, false).First();
var luaName = Name + "." + luaMethodAttr.Name;
var luaName = $"{Name}.{luaMethodAttr.Name}";
Lua.RegisterFunction(luaName, this, method);
docs?.Add(new LibraryFunction(Name, callingLibrary.Description(), method));

View File

@ -67,8 +67,7 @@ namespace BizHawk.Client.Common
return d.PeekByte(addr);
}
Log("Warning: attempted read of " + addr +
" outside the memory size of " + d.Size);
Log($"Warning: attempted read of {addr} outside the memory size of {d.Size}");
return 0;
}
@ -83,8 +82,7 @@ namespace BizHawk.Client.Common
}
else
{
Log("Warning: attempted write to " + addr +
" outside the memory size of " + d.Size);
Log($"Warning: attempted write to {addr} outside the memory size of {d.Size}");
}
}
else
@ -188,8 +186,7 @@ namespace BizHawk.Client.Common
}
else
{
Log("Warning: Attempted read " + lastAddr + " outside memory domain size of " +
d.Size + " in readbyterange()");
Log($"Warning: Attempted read {lastAddr} outside memory domain size of {d.Size} in readbyterange()");
}
return table;
@ -209,8 +206,7 @@ namespace BizHawk.Client.Common
}
else
{
Log("Warning: Attempted write " + addr + " outside memory domain size of " +
d.Size + " in writebyterange()");
Log($"Warning: Attempted write {addr} outside memory domain size of {d.Size} in writebyterange()");
}
}
}
@ -230,8 +226,7 @@ namespace BizHawk.Client.Common
return BitConverter.ToSingle(bytes, 0);
}
Log("Warning: Attempted read " + addr +
" outside memory size of " + d.Size);
Log($"Warning: Attempted read {addr} outside memory size of {d.Size}");
return 0;
}
@ -250,8 +245,7 @@ namespace BizHawk.Client.Common
}
else
{
Log("Warning: Attempted write " + addr +
" outside memory size of " + d.Size);
Log($"Warning: Attempted write {addr} outside memory size of {d.Size}");
}
}
else

View File

@ -1,5 +1,8 @@
using System;
using System.Runtime.InteropServices;
using BizHawk.Common;
using NLua;
// TODO - evaluate for re-entrancy problems
@ -18,16 +21,14 @@ namespace BizHawk.Client.Common
private string _currentDirectory;
#if WINDOWS
[DllImport("kernel32.dll", SetLastError = true)]
static extern bool SetCurrentDirectoryW(byte* lpPathName);
[DllImport("kernel32.dll", SetLastError=true)]
static extern uint GetCurrentDirectoryW(uint nBufferLength, byte* pBuffer);
#endif
private bool CoolSetCurrentDirectory(string path, string currDirSpeedHack = null)
{
string target = _currentDirectory + "\\";
string target = $"{_currentDirectory}\\";
// first we'll bypass it with a general hack: dont do any setting if the value's already there (even at the OS level, setting the directory can be slow)
// yeah I know, not the smoothest move to compare strings here, in case path normalization is happening at some point
@ -42,40 +43,43 @@ namespace BizHawk.Client.Common
return true;
}
// WARNING: setting the current directory is SLOW!!! security checks for some reason.
// so we're bypassing it with windows hacks
#if WINDOWS
fixed (byte* pstr = &System.Text.Encoding.Unicode.GetBytes(target + "\0")[0])
if (OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows)
{
// WARNING: setting the current directory is SLOW!!! security checks for some reason.
// so we're bypassing it with windows hacks
fixed (byte* pstr = &System.Text.Encoding.Unicode.GetBytes($"{target}\0")[0])
return SetCurrentDirectoryW(pstr);
#else
if (System.IO.Directory.Exists(CurrentDirectory)) // race condition for great justice
{
Environment.CurrentDirectory = CurrentDirectory; // thats right, you can't set a directory as current that doesnt exist because .net's got to do SENSELESS SLOW-ASS SECURITY CHECKS on it and it can't do that on a NONEXISTENT DIRECTORY
return true;
}
else
{
return false;
}
#endif
}
else
{
if (System.IO.Directory.Exists(_currentDirectory)) // race condition for great justice
{
Environment.CurrentDirectory = _currentDirectory; // thats right, you can't set a directory as current that doesnt exist because .net's got to do SENSELESS SLOW-ASS SECURITY CHECKS on it and it can't do that on a NONEXISTENT DIRECTORY
return true;
}
else
{
return false;
}
}
}
private string CoolGetCurrentDirectory()
{
// GUESS WHAT!
// .NET DOES A SECURITY CHECK ON THE DIRECTORY WE JUST RETRIEVED
// AS IF ASKING FOR THE CURRENT DIRECTORY IS EQUIVALENT TO TRYING TO ACCESS IT
// SCREW YOU
#if WINDOWS
if (OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows)
{
// GUESS WHAT!
// .NET DOES A SECURITY CHECK ON THE DIRECTORY WE JUST RETRIEVED
// AS IF ASKING FOR THE CURRENT DIRECTORY IS EQUIVALENT TO TRYING TO ACCESS IT
// SCREW YOU
var buf = new byte[32768];
fixed(byte* pBuf = &buf[0])
{
uint ret = GetCurrentDirectoryW(32767, pBuf);
return System.Text.Encoding.Unicode.GetString(buf, 0, (int)ret*2);
}
#else
fixed (byte* pBuf = &buf[0])
return System.Text.Encoding.Unicode.GetString(buf, 0, 2 * (int) GetCurrentDirectoryW(32767, pBuf));
}
else
{
return Environment.CurrentDirectory;
#endif
}
}
private void Sandbox(Action callback, Action exceptionCallback)

View File

@ -25,11 +25,7 @@ namespace BizHawk.Client.Common
}
catch (Exception ex)
{
logCallback(
"error running function attached by the event " +
Event +
"\nError message: " +
ex.Message);
logCallback($"error running function attached by the event {Event}\nError message: {ex.Message}");
}
};

View File

@ -201,7 +201,7 @@ namespace BizHawk.Client.Common
var result = Movie.Stop(saveChanges);
if (result)
{
Output(Path.GetFileName(Movie.Filename) + " written to disk.");
Output($"{Path.GetFileName(Movie.Filename)} written to disk.");
}
Output(message);
@ -225,7 +225,7 @@ namespace BizHawk.Client.Common
if (Movie.IsPlaying)
{
Movie.ClearFrame(Global.Emulator.Frame);
Output("Scrubbed input at frame " + Global.Emulator.Frame);
Output($"Scrubbed input at frame {Global.Emulator.Frame}");
}
}

View File

@ -35,7 +35,7 @@ namespace BizHawk.Client.Common
return "Recording None";
}
return "Recording Player " + CurrentPlayer;
return $"Recording Player {CurrentPlayer}";
}
}

View File

@ -59,19 +59,9 @@ namespace BizHawk.Client.Common
int startTime = (int)(start * 1000 / fps);
int endTime = (int)(end * 1000 / fps);
var startString = string.Format(
"{0:d2}:{1:d2}:{2:d2},{3:d3}",
startTime / 3600000,
(startTime / 60000) % 60,
(startTime / 1000) % 60,
startTime % 1000);
var startString = $"{startTime / 3600000:d2}:{(startTime / 60000) % 60:d2}:{(startTime / 1000) % 60:d2},{startTime % 1000:d3}";
var endString = string.Format(
"{0:d2}:{1:d2}:{2:d2},{3:d3}",
endTime / 3600000,
(endTime / 60000) % 60,
(endTime / 1000) % 60,
endTime % 1000);
var endString = $"{endTime / 3600000:d2}:{(endTime / 60000) % 60:d2}:{(endTime / 1000) % 60:d2},{endTime % 1000:d3}";
sb.Append(startString);
sb.Append(" --> ");

View File

@ -103,7 +103,7 @@ namespace BizHawk.Client.Common
if (i > 0 && lastframe == subs[i].Frame)
{
subs[i].Message = subs[i - 1].Message + " " + subs[i].Message;
subs[i].Message = $"{subs[i - 1].Message} {subs[i].Message}";
subs.Remove(subs[i - 1]);
i--;
}

View File

@ -93,11 +93,17 @@ namespace BizHawk.Client.Common
{
if (value)
{
Header.Add(HeaderKeys.STARTSFROMSAVERAM, "True");
if (!Header.ContainsKey(HeaderKeys.STARTSFROMSAVERAM))
{
Header.Add(HeaderKeys.STARTSFROMSAVERAM, "True");
}
}
else
{
Header.Remove(HeaderKeys.STARTSFROMSAVERAM);
if (Header.ContainsKey(HeaderKeys.STARTSFROMSAVERAM))
{
Header.Remove(HeaderKeys.STARTSFROMSAVERAM);
}
}
}
}

View File

@ -250,10 +250,7 @@ namespace BizHawk.Client.Common
return true;
}
errorMessage = "The savestate is from frame "
+ newLog.Count
+ " which is greater than the current movie length of "
+ Log.Count;
errorMessage = $"The savestate is from frame {newLog.Count} which is greater than the current movie length of {Log.Count}";
return false;
}
@ -262,9 +259,7 @@ namespace BizHawk.Client.Common
{
if (Log[i] != newLog[i])
{
errorMessage = "The savestate input does not match the movie input at frame "
+ (i + 1)
+ ".";
errorMessage = $"The savestate input does not match the movie input at frame {(i + 1)}.";
return false;
}

View File

@ -253,7 +253,7 @@ namespace BizHawk.Client.Common
string prefix = "";
if (ControlType != "Gameboy Controller" && ControlType != "TI83 Controller")
{
prefix = "P" + player + " ";
prefix = $"P{player} ";
}
foreach (string button in BkmMnemonicConstants.Buttons[ControlType].Keys)
@ -352,7 +352,7 @@ namespace BizHawk.Client.Common
int start = 3;
foreach (string button in BkmMnemonicConstants.Buttons[ControlType].Keys)
{
Force("P" + player + " " + button, c[srcindex + start++]);
Force($"P{player} {button}", c[srcindex + start++]);
}
}
}
@ -393,7 +393,7 @@ namespace BizHawk.Client.Common
int start = 3;
foreach (string button in BkmMnemonicConstants.Buttons["GPGX 3-Button Controller"].Keys)
{
Force("P" + player + " " + button, c[srcindex + start++]);
Force($"P{player} {button}", c[srcindex + start++]);
}
}
}
@ -429,7 +429,7 @@ namespace BizHawk.Client.Common
int start = 3;
foreach (var button in BkmMnemonicConstants.Buttons[ControlType].Keys)
{
Force("P" + player + " " + button, c[srcindex + start++]);
Force($"P{player} {button}", c[srcindex + start++]);
}
}
}
@ -497,12 +497,12 @@ namespace BizHawk.Client.Common
int start = 3;
foreach (string button in BkmMnemonicConstants.Buttons[ControlType].Keys)
{
Force("P" + player + " " + button, c[srcindex + start++]);
Force($"P{player} {button}", c[srcindex + start++]);
}
foreach (string name in BkmMnemonicConstants.Analogs[ControlType].Keys)
{
Force("P" + player + " " + name, int.Parse(mnemonic.Substring(srcindex + start, 4)));
Force($"P{player} {name}", int.Parse(mnemonic.Substring(srcindex + start, 4)));
start += 5;
}
}
@ -539,7 +539,7 @@ namespace BizHawk.Client.Common
int start = 3;
foreach (string button in BkmMnemonicConstants.Buttons[ControlType].Keys)
{
Force("P" + player + " " + button, c[srcindex + start++]);
Force($"P{player} {button}", c[srcindex + start++]);
}
}
}
@ -585,7 +585,7 @@ namespace BizHawk.Client.Common
foreach (string button in BkmMnemonicConstants.Buttons[ControlType].Keys)
{
Force("P" + player + " " + button, c[srcindex + start++]);
Force($"P{player} {button}", c[srcindex + start++]);
}
}
}
@ -635,7 +635,7 @@ namespace BizHawk.Client.Common
int start = 1;
foreach (var button in BkmMnemonicConstants.Buttons[ControlType].Keys)
{
Force("P" + player + " " + button, c[srcindex + start++]);
Force($"P{player} {button}", c[srcindex + start++]);
}
}

View File

@ -165,7 +165,7 @@ namespace BizHawk.Client.Common
var prefix = "";
if (_controlType != "Gameboy Controller" && _controlType != "TI83 Controller")
{
prefix = "P" + player + " ";
prefix = $"P{player} ";
}
foreach (var button in BkmMnemonicConstants.Buttons[_controlType].Keys)
@ -313,7 +313,7 @@ namespace BizHawk.Client.Common
{
foreach (var button in BkmMnemonicConstants.Buttons[_controlType].Keys)
{
input.Append(IsBasePressed("P" + player + " " + button) ? BkmMnemonicConstants.Buttons[_controlType][button] : ".");
input.Append(IsBasePressed($"P{player} {button}") ? BkmMnemonicConstants.Buttons[_controlType][button] : ".");
}
input.Append("|");
@ -330,7 +330,7 @@ namespace BizHawk.Client.Common
{
foreach (var button in BkmMnemonicConstants.Buttons[_controlType].Keys)
{
input.Append(IsBasePressed("P" + player + " " + button) ? BkmMnemonicConstants.Buttons[_controlType][button] : ".");
input.Append(IsBasePressed($"P{player} {button}") ? BkmMnemonicConstants.Buttons[_controlType][button] : ".");
}
input.Append('|');
@ -398,7 +398,7 @@ namespace BizHawk.Client.Common
{
foreach (var button in BkmMnemonicConstants.Buttons[_controlType].Keys)
{
input.Append(IsBasePressed("P" + player + " " + button) ? BkmMnemonicConstants.Buttons[_controlType][button] : ".");
input.Append(IsBasePressed($"P{player} {button}") ? BkmMnemonicConstants.Buttons[_controlType][button] : ".");
}
input.Append('|');
@ -448,7 +448,7 @@ namespace BizHawk.Client.Common
{
foreach (var button in BkmMnemonicConstants.Buttons[_controlType].Keys)
{
input.Append(IsBasePressed("P" + player + " " + button) ? BkmMnemonicConstants.Buttons[_controlType][button] : ".");
input.Append(IsBasePressed($"P{player} {button}") ? BkmMnemonicConstants.Buttons[_controlType][button] : ".");
}
if (BkmMnemonicConstants.Analogs[_controlType].Keys.Count > 0)
@ -460,37 +460,37 @@ namespace BizHawk.Client.Common
// Nasty hackery
if (name == "Y Axis")
{
if (IsBasePressed("P" + player + " A Up"))
if (IsBasePressed($"P{player} A Up"))
{
val = 127;
}
else if (IsBasePressed("P" + player + " A Down"))
else if (IsBasePressed($"P{player} A Down"))
{
val = -127;
}
else
{
val = (int)GetBaseFloat("P" + player + " " + name);
val = (int)GetBaseFloat($"P{player} {name}");
}
}
else if (name == "X Axis")
{
if (IsBasePressed("P" + player + " A Left"))
if (IsBasePressed($"P{player} A Left"))
{
val = -127;
}
else if (IsBasePressed("P" + player + " A Right"))
else if (IsBasePressed($"P{player} A Right"))
{
val = 127;
}
else
{
val = (int)GetBaseFloat("P" + player + " " + name);
val = (int)GetBaseFloat($"P{player} {name}");
}
}
else
{
val = (int)GetBaseFloat("P" + player + " " + name);
val = (int)GetBaseFloat($"P{player} {name}");
}
if (val >= 0)
@ -532,7 +532,7 @@ namespace BizHawk.Client.Common
{
foreach (var button in BkmMnemonicConstants.Buttons[_controlType].Keys)
{
input.Append(IsBasePressed("P" + player + " " + button) ? BkmMnemonicConstants.Buttons[_controlType][button] : ".");
input.Append(IsBasePressed($"P{player} {button}") ? BkmMnemonicConstants.Buttons[_controlType][button] : ".");
}
input.Append('|');
@ -563,7 +563,7 @@ namespace BizHawk.Client.Common
{
foreach (var button in BkmMnemonicConstants.Buttons[_controlType].Keys)
{
input.Append(IsBasePressed("P" + player + " " + button) ? BkmMnemonicConstants.Buttons[_controlType][button] : ".");
input.Append(IsBasePressed($"P{player} {button}") ? BkmMnemonicConstants.Buttons[_controlType][button] : ".");
}
input.Append("|");
@ -595,7 +595,7 @@ namespace BizHawk.Client.Common
{
foreach (var button in BkmMnemonicConstants.Buttons[_controlType].Keys)
{
input.Append(IsBasePressed("P" + player + " " + button) ? BkmMnemonicConstants.Buttons[_controlType][button] : ".");
input.Append(IsBasePressed($"P{player} {button}") ? BkmMnemonicConstants.Buttons[_controlType][button] : ".");
}
input.Append("|");

View File

@ -265,7 +265,7 @@ namespace BizHawk.Client.Common
// TODO: clean this up
if (_loopOffset.HasValue)
{
sw.WriteLine("LoopOffset " + _loopOffset);
sw.WriteLine($"LoopOffset {_loopOffset}");
}
foreach (var input in _log)

View File

@ -254,10 +254,7 @@ namespace BizHawk.Client.Common
return true;
}
errorMessage = "The savestate is from frame "
+ log.Count
+ " which is greater than the current movie length of "
+ _log.Count;
errorMessage = $"The savestate is from frame {log.Count} which is greater than the current movie length of {_log.Count}";
return false;
}
@ -266,9 +263,7 @@ namespace BizHawk.Client.Common
{
if (_log[i] != log[i])
{
errorMessage = "The savestate input does not match the movie input at frame "
+ (i + 1)
+ ".";
errorMessage = $"The savestate input does not match the movie input at frame {(i + 1)}.";
return false;
}

View File

@ -16,7 +16,7 @@ namespace BizHawk.Client.Common.MovieConversionExtensions
{
public static TasMovie ToTasMovie(this IMovie old, bool copy = false)
{
string newFilename = old.Filename + "." + TasMovie.Extension;
string newFilename = $"{old.Filename}.{TasMovie.Extension}";
if (File.Exists(newFilename))
{
@ -26,7 +26,7 @@ namespace BizHawk.Client.Common.MovieConversionExtensions
{
if (File.Exists(newFilename))
{
newFilename = old.Filename + " (" + fileNum + ")" + "." + TasMovie.Extension;
newFilename = $"{old.Filename} ({fileNum}).{TasMovie.Extension}";
fileNum++;
}
else
@ -131,11 +131,11 @@ namespace BizHawk.Client.Common.MovieConversionExtensions
if (old.Filename.Contains("tasproj"))
{
newFilename = newFilename.Remove(newFilename.Length - 7, 7);
newFilename = newFilename + "nfn." + TasMovie.Extension;
newFilename = $"{newFilename}nfn.{TasMovie.Extension}";
}
else
{
newFilename = old.Filename + "." + TasMovie.Extension;
newFilename = $"{old.Filename}.{TasMovie.Extension}";
}
if (File.Exists(newFilename))
@ -146,7 +146,7 @@ namespace BizHawk.Client.Common.MovieConversionExtensions
{
if (File.Exists(newFilename))
{
newFilename = old.Filename + " (" + fileNum + ")" + "." + TasMovie.Extension;
newFilename = $"{old.Filename} ({fileNum}).{TasMovie.Extension}";
fileNum++;
}
else
@ -216,11 +216,11 @@ namespace BizHawk.Client.Common.MovieConversionExtensions
if (old.Filename.Contains("tasproj"))
{
newFilename = newFilename.Remove(newFilename.Length - 7, 7);
newFilename = newFilename + "nfsr." + TasMovie.Extension;
newFilename = $"{newFilename}nfsr.{TasMovie.Extension}";
}
else
{
newFilename = old.Filename + "." + TasMovie.Extension;
newFilename = $"{old.Filename}.{TasMovie.Extension}";
}
if (File.Exists(newFilename))
@ -231,7 +231,7 @@ namespace BizHawk.Client.Common.MovieConversionExtensions
{
if (File.Exists(newFilename))
{
newFilename = old.Filename + " (" + fileNum + ")" + "." + TasMovie.Extension;
newFilename = $"{old.Filename} ({fileNum}).{TasMovie.Extension}";
fileNum++;
}
else
@ -323,7 +323,7 @@ namespace BizHawk.Client.Common.MovieConversionExtensions
{
foreach (var firmware in Global.FirmwareManager.RecentlyServed)
{
var key = firmware.SystemId + "_Firmware_" + firmware.FirmwareId;
var key = $"{firmware.SystemId}_Firmware_{firmware.FirmwareId}";
if (!movie.HeaderEntries.ContainsKey(key))
{

View File

@ -57,7 +57,7 @@ namespace BizHawk.Client.Common
}
else
{
Result.Movie.Comments.Add(Movieorigin + " .fm2 version 3");
Result.Movie.Comments.Add($"{Movieorigin} .fm2 version 3");
}
}
else if (line.ToLower().StartsWith("romfilename"))
@ -139,7 +139,7 @@ namespace BizHawk.Client.Common
string length = line.Substring(first + 1, second - first - 1);
string message = line.Substring(second + 1).Trim();
return "subtitle " + frame + " 0 0 " + length + " FFFFFFFF " + message;
return $"subtitle {frame} 0 0 {length} FFFFFFFF {message}";
}
return null;

View File

@ -41,7 +41,7 @@ namespace BizHawk.Client.Common
return Result;
}
var newFileName = SourceFile.FullName + "." + Bk2Movie.Extension;
var newFileName = $"{SourceFile.FullName}.{Bk2Movie.Extension}";
Result.Movie = new Bk2Movie(newFileName);
RunImport();

View File

@ -57,7 +57,7 @@ namespace BizHawk.Client.Common
}
else
{
messageCallback(Path.GetFileName(fn) + " imported as " + m.Filename);
messageCallback($"{Path.GetFileName(fn)} imported as {m.Filename}");
}
if (!Directory.Exists(d))
@ -83,7 +83,7 @@ namespace BizHawk.Client.Common
if (importerType == default(Type))
{
errorMsg = "No importer found for file type " + ext;
errorMsg = $"No importer found for file type {ext}";
return null;
}
@ -205,7 +205,7 @@ namespace BizHawk.Client.Common
if (m != null)
{
m.Filename += "." + BkmMovie.Extension;
m.Filename += $".{BkmMovie.Extension}";
}
else
{
@ -230,7 +230,7 @@ namespace BizHawk.Client.Common
{
"BKM", "FCM", "FM2", "FMV", "GMV", "MCM", "MC2", "MMV", "NMV", "LSMV", "SMV", "VBM", "VMV", "YMV", "ZMV"
};
return extensions.Any(ext => extension.ToUpper() == "." + ext);
return extensions.Any(ext => extension.ToUpper() == $".{ext}");
}
// Reduce all whitespace to single spaces.
@ -261,7 +261,7 @@ namespace BizHawk.Client.Common
for (int section = 2; section < sections.Length - 1; section++)
{
int player = section - 1; // We start with 1
string prefix = "P" + player + " "; // "P1"
string prefix = $"P{player} "; // "P1"
for (int button = 0; button < buttons.Length; button++)
{
@ -344,7 +344,7 @@ namespace BizHawk.Client.Common
if (warningMsg != "")
{
warningMsg = "Unable to import " + warningMsg + " command on line " + lineNum + ".";
warningMsg = $"Unable to import {warningMsg} command on line {lineNum}.";
}
}
}
@ -397,7 +397,7 @@ namespace BizHawk.Client.Common
{
// The player number is one less than the section number for the reasons explained above.
int player = section + playerOffset;
string prefix = "P" + player + " ";
string prefix = $"P{player} ";
// Gameboy doesn't currently have a prefix saying which player the input is for.
if (controllers.Definition.Name == "Gameboy Controller")
@ -450,7 +450,7 @@ namespace BizHawk.Client.Common
}
string message = line.Substring(second + 1).Trim();
m.Subtitles.AddFromString("subtitle " + frame + " 0 0 " + length + " FFFFFFFF " + message);
m.Subtitles.AddFromString($"subtitle {frame} 0 0 {length} FFFFFFFF {message}");
}
return m;
@ -507,14 +507,12 @@ namespace BizHawk.Client.Common
}
else if (line.ToLower().StartsWith("emuversion"))
{
m.Comments.Add(
EMULATIONORIGIN + " " + emulator + " version " + ParseHeader(line, "emuVersion"));
m.Comments.Add($"{EMULATIONORIGIN} {emulator} version {ParseHeader(line, "emuVersion")}");
}
else if (line.ToLower().StartsWith("version"))
{
string version = ParseHeader(line, "version");
m.Comments.Add(
MOVIEORIGIN + " " + Path.GetExtension(path) + " version " + version);
m.Comments.Add($"{MOVIEORIGIN} {Path.GetExtension(path)} version {version}");
if (Path.GetExtension(path).ToUpper() == ".FM2" && version != "3")
{
errorMsg = ".FM2 movie version must always be 3.";
@ -683,7 +681,7 @@ namespace BizHawk.Client.Common
return null;
}
m.Comments.Add(MOVIEORIGIN + " .FCM version " + version);
m.Comments.Add($"{MOVIEORIGIN} .FCM version {version}");
// 008 1-byte flags
byte flags = r.ReadByte();
@ -715,7 +713,7 @@ namespace BizHawk.Client.Common
// other: reserved, set to 0
bool syncHack = ((flags >> 4) & 0x1) != 0;
m.Comments.Add(SYNCHACK + " " + syncHack);
m.Comments.Add($"{SYNCHACK} {syncHack}");
// 009 1-byte flags: reserved, set to 0
r.ReadByte();
@ -749,7 +747,7 @@ namespace BizHawk.Client.Common
// 030 4-byte little-endian unsigned int: version of the emulator used
uint emuVersion = r.ReadUInt32();
m.Comments.Add(EMULATIONORIGIN + " FCEU " + emuVersion);
m.Comments.Add($"{EMULATIONORIGIN} FCEU {emuVersion}");
// 034 name of the ROM used - UTF8 encoded nul-terminated string.
List<byte> gameBytes = new List<byte>();
@ -870,7 +868,7 @@ namespace BizHawk.Client.Common
if (warningMsg != "")
{
warningMsg = "Unable to import " + warningMsg + " command at frame " + frame + ".";
warningMsg = $"Unable to import {warningMsg} command at frame {frame}.";
}
}
@ -917,7 +915,7 @@ namespace BizHawk.Client.Common
The controller update toggles the affected input. Controller update data is emitted to the movie file
only when the state of the controller changes.
*/
controllers["P" + player + " " + buttons[button]] = !controllers["P" + player + " " + buttons[button]];
controllers[$"P{player} {buttons[button]}"] = !controllers[$"P{player} {buttons[button]}"];
}
}
@ -1012,12 +1010,12 @@ namespace BizHawk.Client.Common
// 010 64-byte zero-terminated emulator identifier string
string emuVersion = NullTerminated(r.ReadStringFixedAscii(64));
m.Comments.Add(EMULATIONORIGIN + " Famtasia version " + emuVersion);
m.Comments.Add(MOVIEORIGIN + " .FMV");
m.Comments.Add($"{EMULATIONORIGIN} Famtasia version {emuVersion}");
m.Comments.Add($"{MOVIEORIGIN} .FMV");
// 050 64-byte zero-terminated movie title string
string description = NullTerminated(r.ReadStringFixedAscii(64));
m.Comments.Add(COMMENT + " " + description);
m.Comments.Add($"{COMMENT} {description}");
if (!controller1 && !controller2 && !fds)
{
warningMsg = "No input recorded.";
@ -1080,7 +1078,7 @@ namespace BizHawk.Client.Common
{
for (int button = 0; button < buttons.Length; button++)
{
controllers["P" + player + " " + buttons[button]] = ((controllerState >> button) & 0x1) != 0;
controllers[$"P{player} {buttons[button]}"] = ((controllerState >> button) & 0x1) != 0;
}
}
else
@ -1119,8 +1117,8 @@ namespace BizHawk.Client.Common
// 00F ASCII-encoded GMV file format version. The most recent is 'A'. (?)
string version = r.ReadStringFixedAscii(1);
m.Comments.Add(MOVIEORIGIN + " .GMV version " + version);
m.Comments.Add(EMULATIONORIGIN + " Gens");
m.Comments.Add($"{MOVIEORIGIN} .GMV version {version}");
m.Comments.Add($"{EMULATIONORIGIN} Gens");
// 010 4-byte little-endian unsigned int: rerecord count
uint rerecordCount = r.ReadUInt32();
@ -1169,7 +1167,7 @@ namespace BizHawk.Client.Common
// 018 40-byte zero-terminated ASCII movie name string
string description = NullTerminated(r.ReadStringFixedAscii(40));
m.Comments.Add(COMMENT + " " + description);
m.Comments.Add($"{COMMENT} {description}");
/*
040 frame data
@ -1213,7 +1211,7 @@ namespace BizHawk.Client.Common
{
for (int button = 0; button < buttons.Length; button++)
{
controllers["P" + player + " " + buttons[button]] = ((controllerState >> button) & 0x1) == 0;
controllers[$"P{player} {buttons[button]}"] = ((controllerState >> button) & 0x1) == 0;
}
}
else
@ -1222,12 +1220,12 @@ namespace BizHawk.Client.Common
{
if (player1Config == "6")
{
controllers["P1 " + other[button]] = ((controllerState >> button) & 0x1) == 0;
controllers[$"P1 {other[button]}"] = ((controllerState >> button) & 0x1) == 0;
}
if (player2Config == "6")
{
controllers["P2 " + other[button]] = ((controllerState >> (button + 4)) & 0x1) == 0;
controllers[$"P2 {other[button]}"] = ((controllerState >> (button + 4)) & 0x1) == 0;
}
}
}
@ -1275,7 +1273,7 @@ namespace BizHawk.Client.Common
{
if (authorLast != "")
{
authorList += authorLast + ", ";
authorList += $"{authorLast}, ";
}
authorLast = author;
@ -1301,7 +1299,7 @@ namespace BizHawk.Client.Common
hf.BindArchiveMember(item.Index);
var stream = hf.GetStream();
string coreversion = Encoding.UTF8.GetString(stream.ReadAllBytes()).Trim();
m.Comments.Add(COREORIGIN + " " + coreversion);
m.Comments.Add($"{COREORIGIN} {coreversion}");
hf.Unbind();
}
else if (item.Name == "gamename")
@ -1446,7 +1444,7 @@ namespace BizHawk.Client.Common
string rom = Encoding.UTF8.GetString(stream.ReadAllBytes()).Trim();
int pos = item.Name.LastIndexOf(".sha256");
string name = item.Name.Substring(0, pos);
m.Header[SHA256 + "_" + name] = rom;
m.Header[$"{SHA256}_{name}"] = rom;
hf.Unbind();
}
else if (item.Name == "savestate")
@ -1491,7 +1489,7 @@ namespace BizHawk.Client.Common
hf.BindArchiveMember(item.Index);
var stream = hf.GetStream();
string systemid = Encoding.UTF8.GetString(stream.ReadAllBytes()).Trim();
m.Comments.Add(EMULATIONORIGIN + " " + systemid);
m.Comments.Add($"{EMULATIONORIGIN} {systemid}");
hf.Unbind();
}
}
@ -1528,11 +1526,11 @@ namespace BizHawk.Client.Common
// 008 uint32 Mednafen Version (Current is 0A 08)
uint emuVersion = r.ReadUInt32();
m.Comments.Add(EMULATIONORIGIN + " Mednafen " + emuVersion);
m.Comments.Add($"{EMULATIONORIGIN} Mednafen {emuVersion}");
// 00C uint32 Movie Format Version (Current is 01)
uint version = r.ReadUInt32();
m.Comments.Add(MOVIEORIGIN + " .MCM version " + version);
m.Comments.Add($"{MOVIEORIGIN} .MCM version {version}");
// 010 32-byte MD5 of the ROM used
byte[] md5 = r.ReadBytes(16);
@ -1580,7 +1578,7 @@ namespace BizHawk.Client.Common
};
if (!platforms.ContainsKey(platform))
{
errorMsg = "Platform " + platform + " not supported.";
errorMsg = $"Platform {platform} not supported.";
r.Close();
fs.Close();
return null;
@ -1601,7 +1599,7 @@ namespace BizHawk.Client.Common
// TODO: Verify if NTSC/"PAL" mode used for the movie can be detected or not.
// 100 variable Input data
SimpleController controllers = new SimpleController { Definition = new ControllerDefinition { Name = name + " Controller" } };
SimpleController controllers = new SimpleController { Definition = new ControllerDefinition { Name = $"{name} Controller" } };
int bytes = 256;
// The input stream consists of 1 byte for power-on and reset, and then X bytes per each input port per frame.
@ -1632,7 +1630,7 @@ namespace BizHawk.Client.Common
ushort controllerState = r.ReadByte();
for (int button = 0; button < buttons.Length; button++)
{
string prefix = platform == "lynx" ? "" : "P" + player + " "; // hack
string prefix = platform == "lynx" ? "" : $"P{player} "; // hack
controllers[prefix + buttons[button]] = ((controllerState >> button) & 0x1) != 0;
}
}
@ -1677,8 +1675,8 @@ namespace BizHawk.Client.Common
// 0004: 4-byte little endian unsigned int: dega version
uint emuVersion = r.ReadUInt32();
m.Comments.Add(EMULATIONORIGIN + " Dega version " + emuVersion);
m.Comments.Add(MOVIEORIGIN + " .MMV");
m.Comments.Add($"{EMULATIONORIGIN} Dega version {emuVersion}");
m.Comments.Add($"{MOVIEORIGIN} .MMV");
// 0008: 4-byte little endian unsigned int: frame count
uint frameCount = r.ReadUInt32();
@ -1771,7 +1769,7 @@ namespace BizHawk.Client.Common
byte controllerState = r.ReadByte();
for (int button = 0; button < buttons.Length; button++)
{
controllers["P" + player + " " + buttons[button]] = ((controllerState >> button) & 0x1) != 0;
controllers[$"P{player} {buttons[button]}"] = ((controllerState >> button) & 0x1) != 0;
}
if (player == 1)
@ -1810,8 +1808,8 @@ namespace BizHawk.Client.Common
// 004 4-byte version string (example "0960")
string emuVersion = r.ReadStringFixedAscii(4);
m.Comments.Add(EMULATIONORIGIN + " Nintendulator version " + emuVersion);
m.Comments.Add(MOVIEORIGIN + " .NMV");
m.Comments.Add($"{EMULATIONORIGIN} Nintendulator version {emuVersion}");
m.Comments.Add($"{MOVIEORIGIN} .NMV");
// 008 4-byte file size, not including the 16-byte header
r.ReadUInt32();
@ -1918,7 +1916,7 @@ namespace BizHawk.Client.Common
if (warningMsg != "")
{
warningMsg = warningMsg + " is not properly supported.";
warningMsg = $"{warningMsg} is not properly supported.";
}
}
}
@ -1945,7 +1943,7 @@ namespace BizHawk.Client.Common
};
if (expansion != 0 && warningMsg == "")
{
warningMsg = "Expansion port is not properly supported. This movie uses " + expansions[expansion] + ".";
warningMsg = $"Expansion port is not properly supported. This movie uses {expansions[expansion]}.";
}
// 003 1-byte number of bytes per frame, plus flags
@ -1989,7 +1987,7 @@ namespace BizHawk.Client.Common
00C (variable) null-terminated UTF-8 text, movie description (currently not implemented)
*/
string movieDescription = NullTerminated(r.ReadStringFixedAscii((int)r.ReadUInt32()));
m.Comments.Add(COMMENT + " " + movieDescription);
m.Comments.Add($"{COMMENT} {movieDescription}");
// ... 4-byte little-endian unsigned int: length of controller data in bytes
uint length = r.ReadUInt32();
@ -2027,7 +2025,7 @@ namespace BizHawk.Client.Common
{
for (int button = 0; button < buttons.Length; button++)
{
controllers["P" + player + " " + buttons[button]] = ((controllerState >> button) & 0x1) != 0;
controllers[$"P{player} {buttons[button]}"] = ((controllerState >> button) & 0x1) != 0;
}
}
else if (warningMsg == "")
@ -2084,8 +2082,8 @@ namespace BizHawk.Client.Common
return null;
}
m.Comments.Add(EMULATIONORIGIN + " Snes9x version " + version);
m.Comments.Add(MOVIEORIGIN + " .SMV");
m.Comments.Add($"{EMULATIONORIGIN} Snes9x version {version}");
m.Comments.Add($"{MOVIEORIGIN} .SMV");
/*
008 4-byte little-endian integer: movie "uid" - identifies the movie-savestate relationship, also used as the
recording time in Unix epoch format
@ -2302,7 +2300,7 @@ namespace BizHawk.Client.Common
if (peripheral != "" && warningMsg == "")
{
warningMsg = "Unable to import " + peripheral + ".";
warningMsg = $"Unable to import {peripheral}.";
}
}
@ -2311,13 +2309,13 @@ namespace BizHawk.Client.Common
{
for (int button = 0; button < buttons.Length; button++)
{
controllers["P" + player + " " + buttons[button]] =
controllers[$"P{player} {buttons[button]}"] =
((controllerState >> button) & 0x1) != 0;
}
}
else if (warningMsg == "")
{
warningMsg = "Controller " + player + " not supported.";
warningMsg = $"Controller {player} not supported.";
}
}
@ -2475,7 +2473,7 @@ namespace BizHawk.Client.Common
if (isSGB)
{
m.Comments.Add(SUPERGAMEBOYMODE + " True");
m.Comments.Add($"{SUPERGAMEBOYMODE} True");
}
m.Header[HeaderKeys.PLATFORM] = platform;
@ -2521,8 +2519,8 @@ namespace BizHawk.Client.Common
// 030 1-byte unsigned char: minor version/revision number of current VBM version, the latest is "1"
byte minorVersion = r.ReadByte();
m.Comments.Add(MOVIEORIGIN + " .VBM version " + majorVersion + "." + minorVersion);
m.Comments.Add(EMULATIONORIGIN + " Visual Boy Advance");
m.Comments.Add($"{MOVIEORIGIN} .VBM version {majorVersion}.{minorVersion}");
m.Comments.Add($"{EMULATIONORIGIN} Visual Boy Advance");
// 031 1-byte unsigned char: the internal CRC of the ROM used while recording
r.ReadByte();
@ -2559,7 +2557,7 @@ namespace BizHawk.Client.Common
// The following 128 bytes are for a description of the movie. Both parts must be null-terminated.
string movieDescription = NullTerminated(r.ReadStringFixedAscii(128));
m.Comments.Add(COMMENT + " " + movieDescription);
m.Comments.Add($"{COMMENT} {movieDescription}");
r.BaseStream.Position = firstFrameOffset;
SimpleController controllers = new SimpleController { Definition = new ControllerDefinition() };
controllers.Definition.Name = platform != "GBA"
@ -2615,7 +2613,7 @@ namespace BizHawk.Client.Common
{
if (((controllerState >> (button + 10)) & 0x1) != 0)
{
warningMsg = "Unable to import " + other[button] + " at frame " + frame + ".";
warningMsg = $"Unable to import {other[button]} at frame {frame}.";
break;
}
}
@ -2660,12 +2658,12 @@ namespace BizHawk.Client.Common
// 00C 2-byte little-endian integer: movie version 0x0400
ushort version = r.ReadUInt16();
m.Comments.Add(MOVIEORIGIN + " .VMV version " + version);
m.Comments.Add(EMULATIONORIGIN + " VirtuaNES");
m.Comments.Add($"{MOVIEORIGIN} .VMV version {version}");
m.Comments.Add($"{EMULATIONORIGIN} VirtuaNES");
// 00E 2-byte little-endian integer: record version
ushort recordVersion = r.ReadUInt16();
m.Comments.Add(COMMENT + " Record version " + recordVersion);
m.Comments.Add($"{COMMENT} Record version {recordVersion}");
// 010 4-byte flags (control byte)
uint flags = r.ReadUInt32();
@ -2837,12 +2835,12 @@ namespace BizHawk.Client.Common
}
else
{
commandName = "NESCMD_EXCONTROLLER, " + (command & 0xFF00);
commandName = $"NESCMD_EXCONTROLLER, {(command & 0xFF00)}";
}
if (commandName != "" && warningMsg == "")
{
warningMsg = "Unable to run command \"" + commandName + "\".";
warningMsg = $"Unable to run command \"{commandName}\".";
}
}
else if (controllerState == 0xF3)
@ -2852,7 +2850,7 @@ namespace BizHawk.Client.Common
// TODO: Make a clearer warning message.
if (warningMsg == "")
{
warningMsg = "Unable to run SetSyncExData(" + dwdata + ").";
warningMsg = $"Unable to run SetSyncExData({dwdata}).";
}
}
@ -2861,7 +2859,7 @@ namespace BizHawk.Client.Common
for (int button = 0; button < buttons.Length; button++)
{
controllers["P" + player + " " + buttons[button]] = ((controllerState >> button) & 0x1) != 0;
controllers[$"P{player} {buttons[button]}"] = ((controllerState >> button) & 0x1) != 0;
}
}
@ -2901,8 +2899,8 @@ namespace BizHawk.Client.Common
// 003 2-byte little-endian unsigned int: zsnes version number
short version = r.ReadInt16();
m.Comments.Add(EMULATIONORIGIN + " ZSNES version " + version);
m.Comments.Add(MOVIEORIGIN + " .ZMV");
m.Comments.Add($"{EMULATIONORIGIN} ZSNES version {version}");
m.Comments.Add($"{MOVIEORIGIN} .ZMV");
// 005 4-byte little-endian integer: CRC32 of the ROM
int crc32 = r.ReadInt32();
@ -2973,7 +2971,7 @@ namespace BizHawk.Client.Common
if (peripheral != "")
{
warningMsg = "Unable to import " + peripheral + ".";
warningMsg = $"Unable to import {peripheral}.";
}
// 027 1-byte flags:
@ -3182,14 +3180,14 @@ namespace BizHawk.Client.Common
{
for (int button = 0; button < buttons.Length; button++)
{
controllers["P" + player + " " + buttons[button]] =
controllers[$"P{player} {buttons[button]}"] =
((controllerState >> button) & 0x1) != 0;
}
}
}
else if (warningMsg == "")
{
warningMsg = "Controller " + player + " not supported.";
warningMsg = $"Controller {player} not supported.";
}
}
}

View File

@ -45,7 +45,7 @@ namespace BizHawk.Client.Common
string magic = new string(br.ReadChars(4));
if (magic != expectedMagic)
{
Result.Errors.Add("Not a " + expectedMagic + "file: invalid magic number in file header.");
Result.Errors.Add($"Not a {expectedMagic}file: invalid magic number in file header.");
return info;
}
@ -221,7 +221,7 @@ namespace BizHawk.Client.Common
for (int button = 3; button < buttons.Length; button++)
{
controllers["P1 " + buttons[button]] = ((controllerState >> button) & 0x1) != 0;
controllers[$"P1 {buttons[button]}"] = ((controllerState >> button) & 0x1) != 0;
if (((controllerState >> button) & 0x1) != 0 && button > 15)
{
continue;
@ -246,7 +246,7 @@ namespace BizHawk.Client.Common
ushort controllerState = br.ReadUInt16();
for (int button = 0; button < buttons.Length; button++)
{
controllers["P2 " + buttons[button]] = ((controllerState >> button) & 0x1) != 0;
controllers[$"P2 {buttons[button]}"] = ((controllerState >> button) & 0x1) != 0;
if (((controllerState >> button) & 0x1) != 0 && button > 15)
{
continue;
@ -291,7 +291,7 @@ namespace BizHawk.Client.Common
if ((controlState & 0xFC) != 0)
{
Result.Warnings.Add("Ignored toggle hack flag on frame " + frame);
Result.Warnings.Add($"Ignored toggle hack flag on frame {frame}");
}
movie.AppendFrame(controllers);
@ -336,7 +336,7 @@ namespace BizHawk.Client.Common
for (int button = 3; button < buttons.Length; button++)
{
controllers["P1 " + buttons[button]] = br.ReadChar() != '.';
controllers[$"P1 {buttons[button]}"] = br.ReadChar() != '.';
}
if (info.Player1Type == OctoshockDll.ePeripheralType.DualShock)
@ -373,7 +373,7 @@ namespace BizHawk.Client.Common
for (int button = 3; button < buttons.Length; button++)
{
controllers["P2 " + buttons[button]] = br.ReadChar() != '.';
controllers[$"P2 {buttons[button]}"] = br.ReadChar() != '.';
}
if (info.Player2Type == OctoshockDll.ePeripheralType.DualShock)
@ -423,7 +423,7 @@ namespace BizHawk.Client.Common
if ((controlState & 0xFC) != 0)
{
Result.Warnings.Add("Ignored toggle hack flag on frame " + frame);
Result.Warnings.Add($"Ignored toggle hack flag on frame {frame}");
}
// Each controller is terminated with a pipeline.

View File

@ -156,6 +156,8 @@ namespace BizHawk.Client.Common
backwardFrame = currentFrame;
}
}
int decayStatesLast = decayStates;
if (forwardFrame > -1 && backwardFrame > -1)
{
@ -192,10 +194,11 @@ namespace BizHawk.Client.Common
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
if (decayStatesLast == decayStates)
{
if (_tsm.RemoveState(_tsm.GetStateFrameByIndex(1)))
{
// decrementing this if no state was removed is BAD

View File

@ -50,7 +50,7 @@ namespace BizHawk.Client.Common
if (frame > _lagLog.Count)
{
System.Diagnostics.Debug.Print("Lag Log error. f" + frame + ", log: " + _lagLog.Count);
System.Diagnostics.Debug.Print($"Lag Log error. f{frame}, log: {_lagLog.Count}");
return; // Can this break anything?
}

View File

@ -14,7 +14,7 @@ namespace BizHawk.Client.Common
{
if (frame != 0)
{
ChangeLog.AddGeneralUndo(frame - 1, frame - 1, "Record Frame: " + frame);
ChangeLog.AddGeneralUndo(frame - 1, frame - 1, $"Record Frame: {frame}");
}
base.RecordFrame(frame, source);
@ -35,7 +35,7 @@ namespace BizHawk.Client.Common
public override void Truncate(int frame)
{
bool endBatch = ChangeLog.BeginNewBatch("Truncate Movie: " + frame, true);
bool endBatch = ChangeLog.BeginNewBatch($"Truncate Movie: {frame}", true);
ChangeLog.AddGeneralUndo(frame, InputLogLength - 1);
if (frame < Log.Count - 1)
@ -58,7 +58,7 @@ namespace BizHawk.Client.Common
public override void PokeFrame(int frame, IController source)
{
ChangeLog.AddGeneralUndo(frame, frame, "Set Frame At: " + frame);
ChangeLog.AddGeneralUndo(frame, frame, $"Set Frame At: {frame}");
base.PokeFrame(frame, source);
InvalidateAfter(frame);
@ -68,7 +68,7 @@ namespace BizHawk.Client.Common
public void SetFrame(int frame, string source)
{
ChangeLog.AddGeneralUndo(frame, frame, "Set Frame At: " + frame);
ChangeLog.AddGeneralUndo(frame, frame, $"Set Frame At: {frame}");
SetFrameAt(frame, source);
InvalidateAfter(frame);
@ -78,7 +78,7 @@ namespace BizHawk.Client.Common
public override void ClearFrame(int frame)
{
ChangeLog.AddGeneralUndo(frame, frame, "Clear Frame: " + frame);
ChangeLog.AddGeneralUndo(frame, frame, $"Clear Frame: {frame}");
base.ClearFrame(frame);
InvalidateAfter(frame);
@ -88,7 +88,7 @@ namespace BizHawk.Client.Common
public void RemoveFrame(int frame)
{
bool endBatch = ChangeLog.BeginNewBatch("Remove Frame: " + frame, true);
bool endBatch = ChangeLog.BeginNewBatch($"Remove Frame: {frame}", true);
ChangeLog.AddGeneralUndo(frame, InputLogLength - 1);
Log.RemoveAt(frame);
@ -181,7 +181,7 @@ namespace BizHawk.Client.Common
public void RemoveFrames(int removeStart, int removeUpTo, bool fromHistory = false)
{
bool endBatch = ChangeLog.BeginNewBatch("Remove Frames: " + removeStart + "-" + removeUpTo, true);
bool endBatch = ChangeLog.BeginNewBatch($"Remove Frames: {removeStart}-{removeUpTo}", true);
ChangeLog.AddGeneralUndo(removeStart, InputLogLength - 1);
for (int i = removeUpTo - 1; i >= removeStart; i--)
@ -225,7 +225,7 @@ namespace BizHawk.Client.Common
public void InsertInput(int frame, string inputState)
{
bool endBatch = ChangeLog.BeginNewBatch("Insert Frame: " + frame, true);
bool endBatch = ChangeLog.BeginNewBatch($"Insert Frame: {frame}", true);
ChangeLog.AddGeneralUndo(frame, InputLogLength);
Log.Insert(frame, inputState);
@ -258,7 +258,7 @@ namespace BizHawk.Client.Common
public void InsertInput(int frame, IEnumerable<string> inputLog)
{
bool endBatch = ChangeLog.BeginNewBatch("Insert Frame: " + frame, true);
bool endBatch = ChangeLog.BeginNewBatch($"Insert Frame: {frame}", true);
ChangeLog.AddGeneralUndo(frame, InputLogLength + inputLog.Count() - 1);
Log.InsertRange(frame, inputLog);
@ -307,7 +307,7 @@ namespace BizHawk.Client.Common
public void CopyOverInput(int frame, IEnumerable<IController> inputStates)
{
ChangeLog.BeginNewBatch("Copy Over Input: " + frame);
ChangeLog.BeginNewBatch($"Copy Over Input: {frame}");
var lg = LogGeneratorInstance();
var states = inputStates.ToList();
@ -316,7 +316,7 @@ namespace BizHawk.Client.Common
ExtendMovieForEdit(states.Count + frame - Log.Count);
}
ChangeLog.AddGeneralUndo(frame, frame + inputStates.Count() - 1, "Copy Over Input: " + frame);
ChangeLog.AddGeneralUndo(frame, frame + inputStates.Count() - 1, $"Copy Over Input: {frame}");
for (int i = 0; i < states.Count; i++)
{
@ -338,7 +338,7 @@ namespace BizHawk.Client.Common
public void InsertEmptyFrame(int frame, int count = 1, bool fromHistory = false)
{
bool endBatch = ChangeLog.BeginNewBatch("Insert Empty Frame: " + frame, true);
bool endBatch = ChangeLog.BeginNewBatch($"Insert Empty Frame: {frame}", true);
ChangeLog.AddGeneralUndo(frame, InputLogLength + count - 1);
var lg = LogGeneratorInstance();
@ -422,7 +422,7 @@ namespace BizHawk.Client.Common
Changes = true;
InvalidateAfter(frame);
ChangeLog.AddBoolToggle(frame, buttonName, !adapter.IsPressed(buttonName), "Toggle " + buttonName + ": " + frame);
ChangeLog.AddBoolToggle(frame, buttonName, !adapter.IsPressed(buttonName), $"Toggle {buttonName}: {frame}");
}
public void SetBoolState(int frame, string buttonName, bool val)
@ -444,7 +444,7 @@ namespace BizHawk.Client.Common
{
InvalidateAfter(frame);
Changes = true;
ChangeLog.AddBoolToggle(frame, buttonName, old, "Set " + buttonName + "(" + (val ? "On" : "Off") + "): " + frame);
ChangeLog.AddBoolToggle(frame, buttonName, old, $"Set {buttonName}({(val ? "On" : "Off")}): {frame}");
}
}
@ -455,7 +455,7 @@ namespace BizHawk.Client.Common
ExtendMovieForEdit(frame + count - Log.Count);
}
ChangeLog.AddGeneralUndo(frame, frame + count - 1, "Set " + buttonName + "(" + (val ? "On" : "Off") + "): " + frame + "-" + (frame + count - 1));
ChangeLog.AddGeneralUndo(frame, frame + count - 1, $"Set {buttonName}({(val ? "On" : "Off")}): {frame}-{(frame + count - 1)}");
int changed = -1;
for (int i = 0; i < count; i++)
@ -502,7 +502,7 @@ namespace BizHawk.Client.Common
{
InvalidateAfter(frame);
Changes = true;
ChangeLog.AddFloatChange(frame, buttonName, old, val, "Set " + buttonName + "(" + val + "): " + frame);
ChangeLog.AddFloatChange(frame, buttonName, old, val, $"Set {buttonName}({val}): {frame}");
}
}
@ -513,7 +513,7 @@ namespace BizHawk.Client.Common
ExtendMovieForEdit(frame - Log.Count + 1);
}
ChangeLog.AddGeneralUndo(frame, frame + count - 1, "Set " + buttonName + "(" + val + "): " + frame + "-" + (frame + count - 1));
ChangeLog.AddGeneralUndo(frame, frame + count - 1, $"Set {buttonName}({val}): {frame}-{(frame + count - 1)}");
int changed = -1;
for (int i = 0; i < count; i++)

View File

@ -273,7 +273,7 @@ namespace BizHawk.Client.Common
if (name == "")
{
name = "Undo step " + _totalSteps;
name = $"Undo step {_totalSteps}";
}
bool ret = false;
@ -349,11 +349,11 @@ namespace BizHawk.Client.Common
{
if (oldPosition == -1)
{
name = "Set Marker at frame " + newMarker.Frame;
name = $"Set Marker at frame {newMarker.Frame}";
}
else
{
name = "Remove Marker at frame " + oldPosition;
name = $"Remove Marker at frame {oldPosition}";
}
AddMovieAction(name);

View File

@ -55,7 +55,7 @@ namespace BizHawk.Client.Common
_progressReportWorker = progressReportWorker;
if (!Global.Emulator.HasSavestates())
{
throw new InvalidOperationException("Cannot create a TasMovie against a core that does not implement IStatable");
throw new InvalidOperationException($"Cannot create a {nameof(TasMovie)} against a core that does not implement {nameof(IStatable)}");
}
ChangeLog = new TasMovieChangeLog(this);
@ -74,7 +74,7 @@ namespace BizHawk.Client.Common
_progressReportWorker = progressReportWorker;
if (!Global.Emulator.HasSavestates())
{
throw new InvalidOperationException("Cannot create a TasMovie against a core that does not implement IStatable");
throw new InvalidOperationException($"Cannot create a {nameof(TasMovie)} against a core that does not implement {nameof(IStatable)}");
}
ChangeLog = new TasMovieChangeLog(this);

View File

@ -192,7 +192,7 @@ namespace BizHawk.Client.Common
{
if (_mHead == null)
{
throw new InvalidOperationException("Attempted to pop from an empty data structure");
throw new InvalidOperationException($"Attempted to {nameof(Pop)} from an empty data structure");
}
var ret = _mHead.Value;
@ -213,7 +213,7 @@ namespace BizHawk.Client.Common
{
if (_mHead == null)
{
throw new InvalidOperationException("Attempted to peek from an empty data structure");
throw new InvalidOperationException($"Attempted to {nameof(Peek)} from an empty data structure");
}
return _mHead.Value;
@ -223,7 +223,7 @@ namespace BizHawk.Client.Common
{
if (_mTail == null)
{
throw new InvalidOperationException("Attempted to dequeue from an empty data structure");
throw new InvalidOperationException($"Attempted to {nameof(Dequeue)} from an empty data structure");
}
var ret = _mTail.Value;

View File

@ -200,24 +200,7 @@ namespace BizHawk.Client.Common
/// Get a string representation of difference
/// between current value and the previous one
/// </summary>
public override string Diff
{
get
{
string diff = "";
int diffVal = _value - _previous;
if (diffVal > 0)
{
diff = "+";
}
else if (diffVal < 0)
{
diff = "-";
}
return $"{diff}{((byte)Math.Abs(diffVal))}";
}
}
public override string Diff => $"{_value - (short)_previous:+#;-#;0}";
/// <summary>
/// Get the maximum possible value

View File

@ -231,7 +231,7 @@ namespace BizHawk.Client.Common
/// Get a string representation of difference
/// between current value and the previous one
/// </summary>
public override string Diff => (_previous - _value).ToString();
public override string Diff => $"{_value - (long)_previous:+#;-#;0}";
/// <summary>
/// Get the maximum possible value

View File

@ -46,7 +46,7 @@ namespace BizHawk.Client.Common
}
else
{
throw new ArgumentException($"DisplayType {type} is invalid for this type of Watch", nameof(type));
throw new ArgumentException($"{nameof(DisplayType)} {type} is invalid for this type of {nameof(Watch)}", nameof(type));
}
}
@ -573,7 +573,7 @@ namespace BizHawk.Client.Common
{
if (_domain != null)
{
return "X" + (_domain.Size - 1).NumHexDigits();
return $"X{(_domain.Size - 1).NumHexDigits()}";
}
return "";

View File

@ -214,24 +214,7 @@ namespace BizHawk.Client.Common
/// Get a string representation of difference
/// between current value and the previous one
/// </summary>
public override string Diff
{
get
{
string diff = "";
int diffVal = _value - _previous;
if (diffVal > 0)
{
diff = "+";
}
else if (diffVal < 0)
{
diff = "-";
}
return $"{diff}{((ushort)Math.Abs(diffVal))}";
}
}
public override string Diff => $"{_value - (int)_previous:+#;-#;0}";
/// <summary>
/// Get the maximum possible value

View File

@ -218,6 +218,7 @@ namespace BizHawk.Client.DBMan
Lynx,
VB,
UZE,
NGP
NGP,
ChannelF
}
}

View File

@ -14,7 +14,7 @@ namespace BizHawk.Client.DiscoHawk
public About()
{
InitializeComponent();
lblVersion.Text = "v" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
lblVersion.Text = $"v{System.Reflection.Assembly.GetExecutingAssembly().GetName().Version}";
}
private void richTextBox1_LinkClicked(object sender, LinkClickedEventArgs e)

View File

@ -31,7 +31,7 @@ namespace BizHawk.Client.DiscoHawk
for (int sector = 0; sector < trackLength; sector++)
dsr.ReadLBA_2352(startLba + sector, waveData, sector * 2352);
string mp3Path = string.Format("{0} - Track {1:D2}.mp3", Path.Combine(path, filebase), track.Number);
string mp3Path = $"{Path.Combine(path, filebase)} - Track {track.Number:D2}.mp3";
if (File.Exists(mp3Path))
{
if (!confirmed)

View File

@ -102,7 +102,7 @@ namespace BizHawk.Client.DiscoHawk
return asm;
//load missing assemblies by trying to find them in the dll directory
string dllname = new AssemblyName(args.Name).Name + ".dll";
string dllname = $"{new AssemblyName(args.Name).Name}.dll";
string directory = Path.Combine(GetExeDirectoryAbsolute(), "dll");
string fname = Path.Combine(directory, dllname);
if (!File.Exists(fname)) return null;
@ -120,7 +120,7 @@ namespace BizHawk.Client.DiscoHawk
static extern bool DeleteFileW([MarshalAs(UnmanagedType.LPWStr)]string lpFileName);
static void RemoveMOTW(string path)
{
DeleteFileW(path + ":Zone.Identifier");
DeleteFileW($"{path}:Zone.Identifier");
}
static void WhackAllMOTW(string dllDir)
@ -416,8 +416,8 @@ namespace BizHawk.Client.DiscoHawk
sw.Write(" ");
sw.Write(new string('-', count * 4));
sw.WriteLine();
sw_dump_chunk_one(string.Format("SRC #{0,6} ({1})", lba, new Timestamp(lba)), lba, src_databuf, addr, count);
sw_dump_chunk_one(string.Format("DST #{0,6} ({1})", lba, new Timestamp(lba)), lba, dst_databuf, addr, count);
sw_dump_chunk_one($"SRC #{lba,6} ({new Timestamp(lba)})", lba, src_databuf, addr, count);
sw_dump_chunk_one($"DST #{lba,6} ({new Timestamp(lba)})", lba, dst_databuf, addr, count);
};
//verify each sector contents

View File

@ -95,7 +95,7 @@ namespace BizHawk.Client.DiscoHawk
}
var cueBin = boundDisc.DumpCueBin(boundDiscRecord.BaseName, GetCuePrefs());
txtCuePreview.Text = cueBin.cue.Replace("\n", "\r\n"); ;
txtCuePreview.Text = cueBin.cue.Replace("\n", "\r\n");
}
private void btnPresetCanonical_Click(object sender, EventArgs e)

View File

@ -58,7 +58,7 @@ namespace BizHawk.Client.DiscoHawk
string baseName = Path.GetFileNameWithoutExtension(file);
baseName += "_hawked";
string outfile = Path.Combine(Path.GetDirectoryName(file), baseName) + ".ccd";
string outfile = $"{Path.Combine(Path.GetDirectoryName(file), baseName)}.ccd";
CCD_Format.Dump(disc, outfile);
}
this.Cursor = Cursors.Default;

View File

@ -40,7 +40,7 @@ namespace BizHawk.Client.EmuHawk
}
else
{
throw new ArgumentException("AviWriter only takes its own Codec Tokens!");
throw new ArgumentException($"{nameof(AviWriter)} only takes its own {nameof(CodecToken)}s!");
}
}
@ -53,7 +53,7 @@ namespace BizHawk.Client.EmuHawk
int counter = 1;
for (;;)
{
yield return Path.Combine(dir, baseName) + "_" + counter + ext;
yield return Path.Combine(dir, $"{baseName}_{counter}{ext}");
counter++;
}
}
@ -97,7 +97,7 @@ namespace BizHawk.Client.EmuHawk
}
catch (Exception e)
{
MessageBox.Show("AVIFIL32 Thread died:\n\n" + e);
MessageBox.Show($"AVIFIL32 Thread died:\n\n{e}");
}
}
@ -321,11 +321,10 @@ namespace BizHawk.Client.EmuHawk
int bytes = 0;
if (a_bits == 16) bytes = 2;
else if (a_bits == 8) bytes = 1;
else throw new InvalidOperationException("only 8/16 bits audio are supported by AviWriter and you chose: " + a_bits);
else throw new InvalidOperationException($"only 8/16 bits audio are supported by {nameof(AviWriter)} and you chose: {a_bits}");
if (a_channels == 1) { }
else if (a_channels == 2) { }
else throw new InvalidOperationException("only 1/2 channels audio are supported by AviWriter and you chose: " + a_channels);
else throw new InvalidOperationException($"only 1/2 channels audio are supported by {nameof(AviWriter)} and you chose: {a_channels}");
wfex.Init();
wfex.nBlockAlign = (ushort)(bytes * a_channels);
wfex.nChannels = (ushort)a_channels;
@ -648,7 +647,7 @@ namespace BizHawk.Client.EmuHawk
if (Win32.FAILED(Win32.AVIFileOpenW(ref pAviFile, destPath, Win32.OpenFileStyle.OF_CREATE | Win32.OpenFileStyle.OF_WRITE, 0)))
{
throw new InvalidOperationException("Couldnt open dest path for avi file: " + destPath);
throw new InvalidOperationException($"Couldnt open dest path for avi file: {destPath}");
}
// initialize the video stream
@ -954,7 +953,7 @@ namespace BizHawk.Client.EmuHawk
CodecToken ct = CodecToken.DeSerialize(Global.Config.AVICodecToken);
if (ct == null)
{
throw new Exception("No default AVICodecToken in config!");
throw new Exception($"No default {nameof(Global.Config.AVICodecToken)} in config!");
}
_currVideoCodecToken = ct;
@ -991,7 +990,7 @@ namespace BizHawk.Client.EmuHawk
// using (Font f = new Font(FontFamily.GenericMonospace, 10))
// g.DrawString(i.ToString(), f, Brushes.Black, 0, 0);
// }
// //bmp.Save(string.Format("c:\\dump\\{0}.bmp", i), ImageFormat.Bmp);
// //bmp.Save($"c:\\dump\\{i}.bmp", ImageFormat.Bmp);
// for (int y = 0, idx = 0; y < 256; y++)
// for (int x = 0; x < 256; x++)
// video.buffer[idx++] = bmp.GetPixel(x, y).ToArgb();

View File

@ -6,6 +6,7 @@ using System.Diagnostics;
using System.Windows.Forms;
using BizHawk.Client.Common;
using BizHawk.Common;
using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk
@ -85,14 +86,10 @@ namespace BizHawk.Client.EmuHawk
try
{
_ffmpeg = new Process();
#if WINDOWS
_ffmpeg.StartInfo.FileName = Path.Combine(PathManager.GetDllDirectory(), "ffmpeg.exe");
#else
ffmpeg.StartInfo.FileName = "ffmpeg"; // expecting native version to be in path
#endif
string filename = _baseName + (_segment > 0 ? $"_{_segment}" : "") + _ext;
_ffmpeg.StartInfo.Arguments = string.Format("-y -f nut -i - {1} \"{0}\"", filename, _token.Commandline);
_ffmpeg.StartInfo.FileName = OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows
? Path.Combine(PathManager.GetDllDirectory(), "ffmpeg.exe")
: "ffmpeg";
_ffmpeg.StartInfo.Arguments = $"-y -f nut -i - {_token.Commandline} \"{_baseName}{(_segment == 0 ? string.Empty : $"_{_segment}")}{_ext}\"";
_ffmpeg.StartInfo.CreateNoWindow = true;
// ffmpeg sends informative display to stderr, and nothing to stdout
@ -100,7 +97,7 @@ namespace BizHawk.Client.EmuHawk
_ffmpeg.StartInfo.RedirectStandardInput = true;
_ffmpeg.StartInfo.UseShellExecute = false;
_commandline = "ffmpeg " + _ffmpeg.StartInfo.Arguments;
_commandline = $"ffmpeg {_ffmpeg.StartInfo.Arguments}";
_ffmpeg.ErrorDataReceived += new DataReceivedEventHandler(StderrHandler);
@ -132,7 +129,7 @@ namespace BizHawk.Client.EmuHawk
_stderr.Dequeue();
}
_stderr.Enqueue(line.Data + "\n");
_stderr.Enqueue($"{line.Data}\n");
}
}
@ -193,7 +190,7 @@ namespace BizHawk.Client.EmuHawk
if (_ffmpeg.HasExited)
{
throw new Exception("unexpected ffmpeg death:\n" + ffmpeg_geterror());
throw new Exception($"unexpected ffmpeg death:\n{ffmpeg_geterror()}");
}
var video = source.GetVideoBuffer();
@ -203,7 +200,7 @@ namespace BizHawk.Client.EmuHawk
}
catch
{
MessageBox.Show("Exception! ffmpeg history:\n" + ffmpeg_geterror());
MessageBox.Show($"Exception! ffmpeg history:\n{ffmpeg_geterror()}");
throw;
}
@ -224,7 +221,7 @@ namespace BizHawk.Client.EmuHawk
}
else
{
throw new ArgumentException("FFmpegWriter can only take its own codec tokens!");
throw new ArgumentException($"{nameof(FFmpegWriter)} can only take its own codec tokens!");
}
}
@ -274,7 +271,7 @@ namespace BizHawk.Client.EmuHawk
{
if (_ffmpeg.HasExited)
{
throw new Exception("unexpected ffmpeg death:\n" + ffmpeg_geterror());
throw new Exception($"unexpected ffmpeg death:\n{ffmpeg_geterror()}");
}
if (samples.Length == 0)
@ -289,7 +286,7 @@ namespace BizHawk.Client.EmuHawk
}
catch
{
MessageBox.Show("Exception! ffmpeg history:\n" + ffmpeg_geterror());
MessageBox.Show($"Exception! ffmpeg history:\n{ffmpeg_geterror()}");
throw;
}
}

View File

@ -61,7 +61,7 @@ namespace BizHawk.Client.EmuHawk
new FormatPreset("MP4", "AVC video and AAC audio in an MP4 container.",
"-c:a aac -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"),
"-c:a libvorbis -c:v libvpx -auto-alt-ref 0 -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.",
@ -142,7 +142,7 @@ namespace BizHawk.Client.EmuHawk
if (listBox1.SelectedIndex != -1)
{
var f = (FormatPreset)listBox1.SelectedItem;
label5.Text = "Extension: " + f.Extension;
label5.Text = $"Extension: {f.Extension}";
label3.Text = f.Desc;
textBox1.Text = f.Commandline;
}

View File

@ -99,7 +99,7 @@ namespace BizHawk.Client.EmuHawk
}
else
{
throw new ArgumentException("GifWriter only takes its own tokens!");
throw new ArgumentException($"{nameof(GifWriter)} only takes its own tokens!");
}
}

View File

@ -45,9 +45,7 @@ namespace BizHawk.Client.EmuHawk
public void AddFrame(IVideoProvider source)
{
string ext = Path.GetExtension(_baseName);
string name = Path.GetFileNameWithoutExtension(_baseName) + "_" + _frame;
name += ext;
name = Path.Combine(Path.GetDirectoryName(_baseName), name);
var name = Path.Combine(Path.GetDirectoryName(_baseName), $"{Path.GetFileNameWithoutExtension(_baseName)}_{_frame}{ext}");
BitmapBuffer bb = new BitmapBuffer(source.BufferWidth, source.BufferHeight, source.GetVideoBuffer());
using (var bmp = bb.ToSysdrawingBitmap())
{

View File

@ -182,7 +182,7 @@ namespace BizHawk.Client.EmuHawk
{
if (!f.CanWrite)
{
throw new ArgumentException("Stream must be writable!");
throw new ArgumentException($"{nameof(Stream)} must be writable!");
}
this.f = f;
@ -671,7 +671,7 @@ namespace BizHawk.Client.EmuHawk
}
catch (Exception e)
{
System.Windows.Forms.MessageBox.Show("JMD Worker Thread died:\n\n" + e);
System.Windows.Forms.MessageBox.Show($"JMD Worker Thread died:\n\n{e}");
return;
}
}

View File

@ -592,7 +592,7 @@ namespace BizHawk.Client.EmuHawk
{
dest.Write(data, 0, actual_length);
_pool.ReleaseBuffer(data);
//dbg.WriteLine(string.Format("{0},{1},{2}", pts, ptsnum, ptsden));
//dbg.WriteLine($"{pts},{ptsnum},{ptsden}");
}
}

View File

@ -38,11 +38,11 @@ namespace BizHawk.Client.EmuHawk
mProjectFile = projFile;
mBaseDirectory = Path.GetDirectoryName(mProjectFile);
string basename = Path.GetFileNameWithoutExtension(projFile);
string framesDirFragment = basename + "_frames";
string framesDirFragment = $"{basename}_frames";
mFramesDirectory = Path.Combine(mBaseDirectory, framesDirFragment);
StringBuilder sb = new StringBuilder();
sb.AppendLine("version=1");
sb.AppendLine("framesdir=" + framesDirFragment);
sb.AppendLine($"framesdir={framesDirFragment}");
File.WriteAllText(mProjectFile, sb.ToString());
}
@ -55,7 +55,7 @@ namespace BizHawk.Client.EmuHawk
using (var bb = new BitmapBuffer(source.BufferWidth, source.BufferHeight, source.GetVideoBuffer()))
{
string subpath = GetAndCreatePathForFrameNum(mCurrFrame);
string path = subpath + ".png";
string path = $"{subpath}.png";
bb.ToSysdrawingBitmap().Save(path, System.Drawing.Imaging.ImageFormat.Png);
}
}
@ -63,7 +63,7 @@ namespace BizHawk.Client.EmuHawk
public void AddSamples(short[] samples)
{
string subpath = GetAndCreatePathForFrameNum(mCurrFrame);
string path = subpath + ".wav";
string path = $"{subpath}.wav";
WavWriterV wwv = new WavWriterV();
wwv.SetAudioParameters(paramSampleRate, paramChannels, paramBits);
wwv.OpenFile(path);
@ -149,7 +149,7 @@ namespace BizHawk.Client.EmuHawk
string subpath = GetPathFragmentForFrameNum(index);
string path = mFramesDirectory;
path = Path.Combine(path, subpath);
string fpath = path + ".nothing";
string fpath = $"{path}.nothing";
Directory.CreateDirectory(Path.GetDirectoryName(fpath));
return path;
}

View File

@ -21,8 +21,8 @@ namespace BizHawk.Client.EmuHawk
string subpath = SynclessRecorder.GetPathFragmentForFrameNum(index);
string path = mFramesDirectory;
path = Path.Combine(path, subpath);
png = path + ".png";
wav = path + ".wav";
png = $"{path}.png";
wav = $"{path}.wav";
}
private string mSynclessConfigFile;
@ -32,7 +32,7 @@ namespace BizHawk.Client.EmuHawk
{
var ofd = new OpenFileDialog
{
FileName = PathManager.FilesystemSafeName(Global.Game) + ".syncless.txt",
FileName = $"{PathManager.FilesystemSafeName(Global.Game)}.syncless.txt",
InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.AvPathFragment, null)
};

View File

@ -265,7 +265,7 @@ namespace BizHawk.Client.EmuHawk
int counter = 1;
while (true)
{
yield return new FileStream(Path.Combine(dir, baseName) + "_" + counter + ext, FileMode.Create);
yield return new FileStream($"{Path.Combine(dir, baseName)}_{counter}{ext}", FileMode.Create);
counter++;
}
}

View File

@ -163,24 +163,16 @@ namespace BizHawk.Client.EmuHawk
private void AboutBox_Load(object sender, EventArgs e)
{
#if DEBUG
Text = "BizHawk Developer Build (DEBUG MODE) GIT " + SubWCRev.GIT_BRANCH + "#" + SubWCRev.GIT_SHORTHASH;
Text = $"BizHawk Developer Build (DEBUG MODE) GIT {SubWCRev.GIT_BRANCH}#{SubWCRev.GIT_SHORTHASH}";
#else
Text = "BizHawk Developer Build (RELEASE MODE) GIT " + SubWCRev.GIT_BRANCH + "#" + SubWCRev.GIT_SHORTHASH;
Text = $"BizHawk Developer Build (RELEASE MODE) GIT {SubWCRev.GIT_BRANCH}#{SubWCRev.GIT_SHORTHASH}";
#endif
if (DateTime.Now.Month == 12)
if (DateTime.Now.Month == 12)
{
if (DateTime.Now.Day > 17 && DateTime.Now.Day <= 25)
{
pictureBox1.Image = Properties.Resources.alt_about_image;
}
if (DateTime.Now.Month == 2)
{
if (DateTime.Now.Day >= 7 && DateTime.Now.Day <= 14)
{
pictureBox1.Image = Properties.Resources.HawkInLove;
pictureBox1.Location = new Point(pictureBox1.Location.X - 40, pictureBox1.Location.Y);
pictureBox1.Width = pictureBox1.Width + 80;
}
}
}

View File

@ -33,7 +33,7 @@ namespace BizHawk.Client.EmuHawk
public string SocketServerSend(string SendString)
{
return "Sent : " + GlobalWin.socketServer.SendString(SendString).ToString() + " bytes";
return $"Sent : {GlobalWin.socketServer.SendString(SendString)} bytes";
}
public string SocketServerResponse()
{
@ -48,14 +48,41 @@ namespace BizHawk.Client.EmuHawk
{
GlobalWin.socketServer.SetTimeout(timeout);
}
public void SocketServerSetIp(string ip)
{
GlobalWin.socketServer.Ip = ip;
}
public void SetSocketServerPort(int port)
{
GlobalWin.socketServer.Port = port;
}
public string SocketServerGetIp()
{
return GlobalWin.socketServer.Ip;
}
public int SocketServerGetPort()
{
return GlobalWin.socketServer.Port;
}
public string SocketServerGetInfo()
{
return GlobalWin.socketServer.GetInfo();
}
// All MemoryMappedFile related methods
public void MmfSetFilename(string filename)
{
GlobalWin.memoryMappedFiles.SetFilename(filename);
GlobalWin.memoryMappedFiles.Filename = filename;
}
public string MmfSetFilename()
public string MmfGetFilename()
{
return GlobalWin.memoryMappedFiles.GetFilename();
return GlobalWin.memoryMappedFiles.Filename;
}
public int MmfScreenshot()
@ -67,10 +94,13 @@ namespace BizHawk.Client.EmuHawk
{
return GlobalWin.memoryMappedFiles.WriteToFile(mmf_filename, Encoding.ASCII.GetBytes(outputString));
}
public string MmfRead(string mmf_filename, int expectedSize)
{
return GlobalWin.memoryMappedFiles.ReadFromFile(mmf_filename, expectedSize).ToString();
}
// All HTTP related methods
public string HttpTest()
{
@ -103,19 +133,19 @@ namespace BizHawk.Client.EmuHawk
}
public void HttpSetPostUrl(string url)
{
GlobalWin.httpCommunication.SetPostUrl(url);
GlobalWin.httpCommunication.PostUrl = url;
}
public void HttpSetGetUrl(string url)
{
GlobalWin.httpCommunication.SetGetUrl(url);
GlobalWin.httpCommunication.GetUrl = url;
}
public string HttpGetPostUrl()
{
return GlobalWin.httpCommunication.GetPostUrl();
return GlobalWin.httpCommunication.PostUrl;
}
public string HttpGetGetUrl()
{
return GlobalWin.httpCommunication.GetGetUrl();
return GlobalWin.httpCommunication.GetUrl;
}
}
}

View File

@ -303,7 +303,7 @@ namespace BizHawk.Client.EmuHawk
{
if (!File.Exists(path))
{
AddMessage("File not found: " + path);
AddMessage($"File not found: {path}");
return;
}
@ -331,7 +331,7 @@ namespace BizHawk.Client.EmuHawk
{
if (!File.Exists(path))
{
Console.WriteLine("File not found: " + path);
Console.WriteLine($"File not found: {path}");
return;
}
@ -371,7 +371,7 @@ namespace BizHawk.Client.EmuHawk
{
if (!File.Exists(path))
{
Console.WriteLine("File not found: " + path);
Console.WriteLine($"File not found: {path}");
return;
}

View File

@ -27,7 +27,7 @@ namespace BizHawk.Client.EmuHawk
{
if (slotNum >= 0 && slotNum <= 9)
{
GlobalWin.MainForm.LoadQuickSave("QuickSave" + slotNum, true);
GlobalWin.MainForm.LoadQuickSave($"QuickSave{slotNum}", true);
}
}
@ -40,7 +40,7 @@ namespace BizHawk.Client.EmuHawk
{
if (slotNum >= 0 && slotNum <= 9)
{
GlobalWin.MainForm.SaveQuickSave("QuickSave" + slotNum);
GlobalWin.MainForm.SaveQuickSave($"QuickSave{slotNum}");
}
}
}

View File

@ -145,8 +145,8 @@ namespace BizHawk.Client.EmuHawk
errMsg = errMsg.Substring(errMsg.IndexOf('-') + 2);
// Balloon is bugged on first invocation
errorBalloon.Show("Error parsing RegEx: " + errMsg, tb);
errorBalloon.Show("Error parsing RegEx: " + errMsg, tb);
errorBalloon.Show($"Error parsing RegEx: {errMsg}", tb);
errorBalloon.Show($"Error parsing RegEx: {errMsg}", tb);
}
}

View File

@ -2,14 +2,15 @@
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Windows.Forms;
namespace BizHawk.Client.EmuHawk
{
class ArgParser
//parses command line arguments and adds the values to a class attribute
//default values are null for strings and false for boolean
//the last value will overwrite previously set values
//unrecognized parameters are simply ignored or in the worst case assumed to be a ROM name [cmdRom]
class ArgParser
//parses command line arguments and adds the values to a class attribute
//default values are null for strings and false for boolean
//the last value will overwrite previously set values
//unrecognized parameters are simply ignored or in the worst case assumed to be a ROM name [cmdRom]
{
public string cmdRom = null;
public string cmdLoadSlot = null;
@ -21,28 +22,28 @@ namespace BizHawk.Client.EmuHawk
public string cmdDumpName = null;
public HashSet<int> _currAviWriterFrameList;
public int _autoDumpLength;
public bool _autoCloseOnDump = false;
// chrome is never shown, even in windowed mode
public bool _autoCloseOnDump = false;
// chrome is never shown, even in windowed mode
public bool _chromeless = false;
public bool startFullscreen = false;
public string luaScript = null;
public bool luaConsole = false;
public int socket_port = 9999;
public int socket_port = 0;
public string socket_ip = null;
public string mmf_filename = null;
public string URL_get = null;
public string URL_post = null;
public bool? audiosync = null;
public void ParseArguments(string[] args)
{
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.
{
// For some reason sometimes visual studio will pass this to us on the commandline. it makes no sense.
if (args[i] == ">")
{
i++;
var stdout = args[i];
var stdout = args[i];
Console.SetOut(new StreamWriter(stdout));
continue;
}
@ -77,9 +78,9 @@ namespace BizHawk.Client.EmuHawk
foreach (string item in items)
{
_currAviWriterFrameList.Add(int.Parse(item));
}
// automatically set dump length to maximum frame
}
// automatically set dump length to maximum frame
_autoDumpLength = _currAviWriterFrameList.OrderBy(x => x).Last();
}
else if (arg.StartsWith("--dump-name="))
@ -131,43 +132,63 @@ namespace BizHawk.Client.EmuHawk
{
URL_post = args[i].Substring(args[i].IndexOf('=') + 1);
}
else if (arg.StartsWith("--audiosync="))
{
audiosync = arg.Substring(arg.IndexOf('=') + 1) == "true";
}
else
{
cmdRom = args[i];
}
}
////initialize HTTP communication
}
//initialize HTTP communication
if (URL_get != null || URL_post != null)
{
GlobalWin.httpCommunication = new Communication.HttpCommunication();
if (URL_get != null)
{
GlobalWin.httpCommunication.initialized = true;
GlobalWin.httpCommunication.SetGetUrl(URL_get);
GlobalWin.httpCommunication.GetUrl = URL_get;
}
if (URL_post != null)
{
GlobalWin.httpCommunication.initialized = true;
GlobalWin.httpCommunication.SetPostUrl(URL_post);
GlobalWin.httpCommunication.PostUrl = URL_post;
}
}
//inititalize socket server
if (socket_ip != null && socket_port > -1)
{
GlobalWin.socketServer.initialized = true;
}
//inititalize socket server
if (socket_ip != null && socket_port > 0)
{
GlobalWin.socketServer = new Communication.SocketServer();
GlobalWin.socketServer.SetIp(socket_ip, socket_port);
}
else if (socket_ip != null)
else if (socket_ip == null ^ socket_port == 0)
{
GlobalWin.socketServer.initialized = true;
GlobalWin.socketServer.SetIp(socket_ip);
}
//initialize mapped memory files
throw new ArgParserException("Socket server needs both --socket_ip and --socket_port. Socket server was not started");
}
//initialize mapped memory files
if (mmf_filename != null)
{
GlobalWin.memoryMappedFiles.initialized = true;
GlobalWin.memoryMappedFiles.SetFilename(mmf_filename);
GlobalWin.memoryMappedFiles = new Communication.MemoryMappedFiles();
GlobalWin.memoryMappedFiles.Filename = mmf_filename;
}
}
public static string GetCmdConfigFile(string[] args)
{
return args.FirstOrDefault(arg => arg.StartsWith("--config=", StringComparison.InvariantCultureIgnoreCase))?.Substring(9);
}
}
class ArgParserException : Exception
{
public ArgParserException()
{
}
public ArgParserException(string message) : base(message)
{
}
}
}
}

View File

@ -31,14 +31,14 @@ namespace BizHawk.Client.EmuHawk
mainversion += " (x64)";
if (VersionInfo.DeveloperBuild)
{
Text = " BizHawk (GIT " + SubWCRev.GIT_BRANCH + "#" + SubWCRev.GIT_SHORTHASH + ")";
Text = $" BizHawk (GIT {SubWCRev.GIT_BRANCH}#{SubWCRev.GIT_SHORTHASH})";
}
else
{
Text = "Version " + mainversion + " (GIT " + SubWCRev.GIT_BRANCH + "#" + SubWCRev.GIT_SHORTHASH + ")";
Text = $"Version {mainversion} (GIT {SubWCRev.GIT_BRANCH}#{SubWCRev.GIT_SHORTHASH})";
}
VersionLabel.Text = "Version " + mainversion;
VersionLabel.Text = $"Version {mainversion}";
DateLabel.Text = VersionInfo.RELEASEDATE;
var cores = Assembly
@ -59,12 +59,12 @@ namespace BizHawk.Client.EmuHawk
});
}
linkLabel2.Text = "Commit # " + SubWCRev.GIT_SHORTHASH;
linkLabel2.Text = $"Commit # {SubWCRev.GIT_SHORTHASH}";
}
private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start("https://github.com/TASVideos/BizHawk/commit/" + SubWCRev.GIT_SHORTHASH);
System.Diagnostics.Process.Start($"https://github.com/TASVideos/BizHawk/commit/{SubWCRev.GIT_SHORTHASH}");
}
private void btnCopyHash_Click(object sender, EventArgs e)

View File

@ -22,7 +22,7 @@ namespace BizHawk.Client.EmuHawk
if (!string.IsNullOrEmpty(attributes.Author))
{
CoreAuthorLabel.Text = "authors: " + attributes.Author;
CoreAuthorLabel.Text = $"authors: {attributes.Author}";
}
else
{

View File

@ -113,8 +113,8 @@
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\BizHawk.Common\PlatformLinkedLibSingleton.cs">
<Link>PlatformLinkedLibSingleton.cs</Link>
<Compile Include="..\BizHawk.Common\OSTailoredCode.cs">
<Link>OSTailoredCode.cs</Link>
</Compile>
<Compile Include="..\Version\svnrev.cs">
<Link>svnrev.cs</Link>
@ -1216,7 +1216,7 @@
<Compile Include="tools\TraceLogger.Designer.cs">
<DependentUpon>TraceLogger.cs</DependentUpon>
</Compile>
<Compile Include="tools\VirtualPads\controls\components\AnalogSticklPanel.cs">
<Compile Include="tools\VirtualPads\controls\components\AnalogStickPanel.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="tools\VirtualPads\controls\IVirtualPadControl.cs" />
@ -1252,6 +1252,7 @@
<Compile Include="tools\VirtualPads\schema\AppleIISchema.cs" />
<Compile Include="tools\VirtualPads\schema\C64Schema.cs" />
<Compile Include="tools\VirtualPads\schema\ColecoSchema.cs" />
<Compile Include="tools\VirtualPads\schema\GGLSchema.cs" />
<Compile Include="tools\VirtualPads\schema\DualGBSchema.cs" />
<Compile Include="tools\VirtualPads\schema\GBASchema.cs" />
<Compile Include="tools\VirtualPads\schema\GBSchema.cs" />
@ -2282,4 +2283,4 @@
<PreBuildEvent />
</PropertyGroup>
<Import Project="$(SolutionDir)Build\Common.targets" />
</Project>
</Project>

View File

@ -12,7 +12,6 @@ using BizHawk.Emulation.Common;
using BizHawk.Client.Common;
using BizHawk.Emulation.Common.IEmulatorExtensions;
using System.Windows.Forms;
using System.IO;
namespace BizHawk.Client.EmuHawk
{
@ -23,16 +22,14 @@ namespace BizHawk.Client.EmuHawk
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;
public string PostUrl { get; set; } = null;
public string GetUrl { get; set; } = null;
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;
@ -41,32 +38,15 @@ namespace BizHawk.Client.EmuHawk
{
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) {
if (response.IsSuccessStatusCode)
{
return await response.Content.ReadAsStringAsync();
}
else
@ -82,11 +62,9 @@ namespace BizHawk.Client.EmuHawk
try
{
response = await client.PostAsync(url, content).ConfigureAwait(false);
}
catch (Exception e)
{
MessageBox.Show(e.ToString());
return e.ToString();
}
@ -161,19 +139,40 @@ namespace BizHawk.Client.EmuHawk
return Post(PostUrl, content).Result;
}
}
public class SocketServer
{
string ip = null;
public string Ip
{
get { return ip; }
set
{
ip = value;
ipAdd = System.Net.IPAddress.Parse(ip);
Connect();
}
}
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;
int port = 0;
public int Port
{
get { return port; }
set
{
port = value;
Connect();
}
}
Decoder decoder = Encoding.UTF8.GetDecoder();
Socket soc = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
IPAddress ipAdd;
IPEndPoint remoteEP;
IVideoProvider currentVideoProvider = null;
public bool connected = false;
public bool initialized = false;
public int retries = 10;
public int Retries { get; set; } = 10;
public bool success = false; //indicates whether the last command was executed succesfully
public void Initialize(IVideoProvider _currentVideoProvider)
@ -181,8 +180,8 @@ namespace BizHawk.Client.EmuHawk
currentVideoProvider = _currentVideoProvider;
SetIp(ip, port);
initialized = true;
}
public void Connect()
{
if (!initialized)
@ -194,42 +193,40 @@ namespace BizHawk.Client.EmuHawk
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 string GetInfo()
{
return $"{ip}:{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;
connected = !(part1 && part2);
}
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;
@ -248,6 +245,7 @@ namespace BizHawk.Client.EmuHawk
{
return SendScreenshot(0);
}
public string SendScreenshot(int waitingTime)
{
if (!connected)
@ -262,7 +260,7 @@ namespace BizHawk.Client.EmuHawk
byte[] bmpBytes = screenShot.ImageToByte(img);
int sentBytes = 0;
int tries = 0;
while (sentBytes <= 0 && tries < retries)
while (sentBytes <= 0 && tries < Retries)
{
try
{
@ -279,7 +277,7 @@ namespace BizHawk.Client.EmuHawk
Connect();
}
}
success = (tries < retries);
success = (tries < Retries);
}
}
String resp = "";
@ -294,7 +292,7 @@ namespace BizHawk.Client.EmuHawk
{
return resp;
}
resp = "";
resp = ReceiveMessage();
if (resp == "")
{
@ -302,6 +300,7 @@ namespace BizHawk.Client.EmuHawk
}
return resp;
}
public string ReceiveMessage()
{
if (!connected)
@ -318,14 +317,15 @@ namespace BizHawk.Client.EmuHawk
{
receivedLength = soc.Receive(receivedBytes, receivedBytes.Length, 0);
resp += Encoding.ASCII.GetString(receivedBytes);
} catch
}
catch
{
receivedLength = 0;
}
}
return resp;
}
public bool Successful()
{
return success;
@ -334,29 +334,19 @@ namespace BizHawk.Client.EmuHawk
public class MemoryMappedFiles
{
public string filename_main = "BizhawkTemp_main";
public string Filename { get; set; } = "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);
return WriteToFile(@Filename, bmpBytes);
}
public int WriteToFile(string filename, byte[] outputBytes)
@ -384,7 +374,6 @@ namespace BizHawk.Client.EmuHawk
}
catch (Exception)
{
}
mmf_file = MemoryMappedFile.CreateOrOpen(filename, outputBytes.Length);
@ -417,6 +406,7 @@ namespace BizHawk.Client.EmuHawk
{
private IVideoProvider currentVideoProvider = null;
private ImageConverter converter = new ImageConverter();
public BitmapBuffer MakeScreenShotImage()
{
if (currentVideoProvider == null)
@ -425,14 +415,17 @@ namespace BizHawk.Client.EmuHawk
}
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();
@ -440,6 +433,18 @@ namespace BizHawk.Client.EmuHawk
return Convert.ToBase64String(imgBytes);
}
}
class CommunicationSocketServerException : Exception
{
public CommunicationSocketServerException()
{
}
public CommunicationSocketServerException(string message) : base(message)
{
}
}
}
}

View File

@ -229,10 +229,7 @@ namespace BizHawk.Client.EmuHawk
.ThenBy(t => t.CoreAttributes.CoreName)
.ToList();
toolStripStatusLabel1.Text = string.Format("Total: {0} Released: {1} Profiled: {2}",
possiblecoretypes.Count,
KnownCores.Values.Count(c => c.Released),
KnownCores.Count);
toolStripStatusLabel1.Text = $"Total: {possiblecoretypes.Count} Released: {KnownCores.Values.Count(c => c.Released)} Profiled: {KnownCores.Count}";
CoreTree.Nodes.Clear();
CoreTree.BeginUpdate();

View File

@ -36,7 +36,7 @@ namespace BizHawk.Client.EmuHawk
_maxSize = domainSize - 1;
MaxLength = _maxSize.Value.NumHexDigits();
_addressFormatStr = "{0:X" + MaxLength + "}";
_addressFormatStr = $"{{0:X{MaxLength}}}";
//try to preserve the old value, as best we can
if(!wasMaxSizeSet)

View File

@ -1196,7 +1196,7 @@ namespace BizHawk.Client.EmuHawk
if (AllowRightClickSelecton && e.Button == MouseButtons.Right)
{
if (!IsHoveringOnColumnCell)
if (!IsHoveringOnColumnCell && CurrentCell != null)
{
_currentX = e.X;
_currentY = e.Y;
@ -2042,7 +2042,7 @@ namespace BizHawk.Client.EmuHawk
// no check will make it crash for user too, not sure which way of alarm we prefer. no alarm at all will cause all sorts of subtle bugs
if (ChangedCallback == null)
{
System.Diagnostics.Debug.Fail("ColumnChangedCallback has died!");
System.Diagnostics.Debug.Fail($"{nameof(ColumnChangedCallback)} has died!");
}
else
{

View File

@ -14,7 +14,7 @@ namespace BizHawk.Client.EmuHawk
// Convenience hack
public override string ToString()
{
return string.IsNullOrEmpty(Column) ? "?" : Column + " - " + (RowIndex.HasValue ? RowIndex.ToString() : "?");
return string.IsNullOrEmpty(Column) ? "?" : $"{Column} - {(RowIndex.HasValue ? RowIndex.ToString() : "?")}";
}
}

View File

@ -398,7 +398,7 @@ namespace BizHawk.Client.EmuHawk
if (value == View.LargeIcon ||
value == View.SmallIcon)
{
throw new ArgumentException("Icon views are invalid for virtual ListViews", "View");
throw new ArgumentException($"Icon views are invalid for virtual {nameof(ListView)}s", nameof(View));
}
base.View = value;
@ -505,7 +505,7 @@ namespace BizHawk.Client.EmuHawk
}
catch (Exception ex)
{
System.Diagnostics.Trace.WriteLine("VirtualListView.SetItemState error=" + ex.Message);
System.Diagnostics.Trace.WriteLine($"VirtualListView.SetItemState error={ex.Message}");
// TODO: should this eat any exceptions?
throw;
@ -551,7 +551,7 @@ namespace BizHawk.Client.EmuHawk
}
catch (Exception e)
{
Debug.WriteLine("Failed to copy text name from client: " + e, "VirtualListView.OnDispInfoNotice");
Debug.WriteLine($"Failed to copy text name from client: {e}", $"{nameof(VirtualListView)}.{nameof(OnDispInfoNotice)}");
}
}
}
@ -687,7 +687,7 @@ namespace BizHawk.Client.EmuHawk
}
catch (Exception ex)
{
Trace.WriteLine(string.Format("Message {0} caused an exception: {1}", m, ex.Message));
Trace.WriteLine($"Message {m} caused an exception: {ex.Message}");
}
}
}
@ -705,7 +705,7 @@ namespace BizHawk.Client.EmuHawk
if (item == null)
{
throw new ArgumentException("cannot find item " + idx + " via QueryItem event");
throw new ArgumentException($"cannot find item {idx} via {nameof(QueryItem)} event");
}
return item;

View File

@ -146,7 +146,7 @@ namespace BizHawk.Client.EmuHawk
public override string ToString()
{
return "{Left: " + _Left + "; " + "Top: " + _Top + "; Right: " + _Right + "; Bottom: " + _Bottom + "}";
return $"{{Left: {_Left}; Top: {_Top}; Right: {_Right}; Bottom: {_Bottom}}}";
}
public override int GetHashCode()

Some files were not shown because too many files have changed in this diff Show More