diff --git a/.gitignore b/.gitignore index 294b6c2a55ce..ceab9b7d341e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +.idea/ + # Generated by Cargo # will have compiled files and executables target/ diff --git a/Cargo.lock b/Cargo.lock index daec3bb94946..8970ce77a214 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -31,15 +31,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "aho-corasick" -version = "0.7.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" -dependencies = [ - "memchr", -] - [[package]] name = "aliasable" version = "0.1.3" @@ -202,12 +193,6 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" -[[package]] -name = "bit_field" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcb6dd1c2376d2e096796e234a70e17e94cc2d5d54ff8ce42b28cef1d0d359a4" - [[package]] name = "bitflags" version = "1.3.2" @@ -248,27 +233,6 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" -[[package]] -name = "block-buffer" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" -dependencies = [ - "generic-array", -] - -[[package]] -name = "bstr" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223" -dependencies = [ - "lazy_static", - "memchr", - "regex-automata", - "serde", -] - [[package]] name = "build_const" version = "0.2.2" @@ -583,41 +547,6 @@ dependencies = [ "cache-padded", ] -[[package]] -name = "console" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28b32d32ca44b70c3e4acd7db1babf555fa026e385fb95f18028f88848b3c31" -dependencies = [ - "encode_unicode", - "libc", - "once_cell", - "regex", - "terminal_size", - "unicode-width", - "winapi", -] - -[[package]] -name = "console_error_panic_hook" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" -dependencies = [ - "cfg-if 1.0.0", - "wasm-bindgen", -] - -[[package]] -name = "console_log" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501a375961cef1a0d44767200e66e4a559283097e91d0730b1d75dfb2f8a1494" -dependencies = [ - "log", - "web-sys", -] - [[package]] name = "convert_case" version = "0.6.0" @@ -736,15 +665,6 @@ dependencies = [ "windows", ] -[[package]] -name = "cpufeatures" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" -dependencies = [ - "libc", -] - [[package]] name = "crc" version = "1.8.1" @@ -763,41 +683,6 @@ dependencies = [ "cfg-if 1.0.0", ] -[[package]] -name = "crossbeam-channel" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521" -dependencies = [ - "cfg-if 1.0.0", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-deque" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "715e8152b692bba2d374b53d4875445368fdf21a94751410af607a5ac677d1fc" -dependencies = [ - "cfg-if 1.0.0", - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "045ebe27666471bb549370b4b0b3e51b07f56325befa4284db65fc89c02511b1" -dependencies = [ - "autocfg", - "cfg-if 1.0.0", - "crossbeam-utils", - "memoffset", - "once_cell", - "scopeguard", -] - [[package]] name = "crossbeam-utils" version = "0.8.11" @@ -831,48 +716,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "csv" -version = "1.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1" -dependencies = [ - "bstr", - "csv-core", - "itoa 0.4.8", - "ryu", - "serde", -] - -[[package]] -name = "csv-core" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" -dependencies = [ - "memchr", -] - -[[package]] -name = "ctor" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f877be4f7c9f246b183111634f75baa039715e3f46ce860677d3b19a69fb229c" -dependencies = [ - "quote", - "syn", -] - [[package]] name = "cty" version = "0.2.2" @@ -1109,22 +952,6 @@ dependencies = [ "syn", ] -[[package]] -name = "diff" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" - -[[package]] -name = "digest" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c" -dependencies = [ - "block-buffer", - "crypto-common", -] - [[package]] name = "dirs" version = "4.0.0" @@ -1180,12 +1007,6 @@ dependencies = [ "wio", ] -[[package]] -name = "either" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f107b87b6afc2a64fd13cac55fe06d6c8859f12d4b14cbcdd2c67d0976781be" - [[package]] name = "embed-resource" version = "1.7.3" @@ -1199,12 +1020,6 @@ dependencies = [ "winreg", ] -[[package]] -name = "encode_unicode" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" - [[package]] name = "encoding_rs" version = "0.8.31" @@ -1262,11 +1077,8 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c90bf5f19754d10198ccb95b70664fc925bd1fc090a0fd9a6ebc54acc8cd6272" dependencies = [ - "atty", "humantime", "log", - "regex", - "termcolor", ] [[package]] @@ -1294,37 +1106,6 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "exporter" -version = "0.1.0" -dependencies = [ - "anyhow", - "clap", - "futures", - "image", - "indicatif", - "log", - "rayon", - "ruffle_core", - "ruffle_render_wgpu", - "walkdir", -] - -[[package]] -name = "exr" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9a7880199e74c6d3fe45579df2f436c5913a71405494cb89d59234d86b47dc5" -dependencies = [ - "bit_field", - "flume", - "half", - "lebe", - "miniz_oxide", - "smallvec", - "threadpool", -] - [[package]] name = "fastrand" version = "1.8.0" @@ -1365,19 +1146,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "flume" -version = "0.10.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1657b4441c3403d9f7b3409e47575237dac27b1b5726df654a6ecbf92f0f7577" -dependencies = [ - "futures-core", - "futures-sink", - "nanorand", - "pin-project", - "spin", -] - [[package]] name = "fnv" version = "1.0.7" @@ -1634,16 +1402,6 @@ dependencies = [ "cfg-if 0.1.10", ] -[[package]] -name = "generic-array" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" -dependencies = [ - "typenum", - "version_check", -] - [[package]] name = "getrandom" version = "0.2.7" @@ -1651,10 +1409,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" dependencies = [ "cfg-if 1.0.0", - "js-sys", "libc", "wasi 0.11.0+wasi-snapshot-preview1", - "wasm-bindgen", ] [[package]] @@ -1667,6 +1423,40 @@ dependencies = [ "weezl", ] +[[package]] +name = "gilrs" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6ba7c37bf8ea7ba0c3e3795dfa1a7771b1e47c4bb417c4d27c7b338d79685f" +dependencies = [ + "fnv", + "gilrs-core", + "log", + "uuid", + "vec_map", +] + +[[package]] +name = "gilrs-core" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96a8d94a7fc5afd27e894e08a4cfe5a49237f85bcc7140e90721bad3399c7d02" +dependencies = [ + "core-foundation", + "io-kit-sys", + "js-sys", + "libc", + "libudev-sys", + "log", + "nix 0.24.2", + "rusty-xinput", + "uuid", + "vec_map", + "wasm-bindgen", + "web-sys", + "winapi", +] + [[package]] name = "gio-sys" version = "0.15.10" @@ -1796,12 +1586,6 @@ dependencies = [ "wide", ] -[[package]] -name = "half" -version = "1.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" - [[package]] name = "hashbrown" version = "0.11.2" @@ -1846,7 +1630,7 @@ checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" dependencies = [ "bytes", "fnv", - "itoa 1.0.2", + "itoa", ] [[package]] @@ -1880,14 +1664,8 @@ dependencies = [ "bytemuck", "byteorder", "color_quant", - "exr", - "gif", - "jpeg-decoder", "num-rational", "num-traits", - "png", - "scoped_threadpool", - "tiff", ] [[package]] @@ -1901,17 +1679,6 @@ dependencies = [ "serde", ] -[[package]] -name = "indicatif" -version = "0.17.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfddc9561e8baf264e0e45e197fd7696320026eb10a8180340debc27b18f535b" -dependencies = [ - "console", - "number_prefix", - "unicode-width", -] - [[package]] name = "inplace_it" version = "0.3.4" @@ -1930,6 +1697,16 @@ dependencies = [ "web-sys", ] +[[package]] +name = "io-kit-sys" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7789f7f3c9686f96164f5109d69152de759e76e284f736bd57661c6df5091919" +dependencies = [ + "core-foundation-sys", + "mach", +] + [[package]] name = "isahc" version = "1.7.2" @@ -1957,12 +1734,6 @@ dependencies = [ "waker-fn", ] -[[package]] -name = "itoa" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" - [[package]] name = "itoa" version = "1.0.2" @@ -2003,9 +1774,6 @@ name = "jpeg-decoder" version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9478aa10f73e7528198d75109c8be5cd7d15fb530238040148d5f9a22d4c5b3b" -dependencies = [ - "rayon", -] [[package]] name = "js-sys" @@ -2039,12 +1807,6 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" -[[package]] -name = "lebe" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8" - [[package]] name = "lexical-core" version = "0.7.6" @@ -2104,6 +1866,16 @@ dependencies = [ "libc", ] +[[package]] +name = "libudev-sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c8469b4a23b962c1396b9b451dda50ef5b283e8dd309d69033475fa9b334324" +dependencies = [ + "libc", + "pkg-config", +] + [[package]] name = "libz-sys" version = "1.1.8" @@ -2133,7 +1905,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ "cfg-if 1.0.0", - "serde", ] [[package]] @@ -2325,15 +2096,6 @@ dependencies = [ "unicode-xid", ] -[[package]] -name = "nanorand" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" -dependencies = [ - "getrandom", -] - [[package]] name = "ndk" version = "0.6.0" @@ -2583,16 +2345,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "num_cpus" -version = "1.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" -dependencies = [ - "hermit-abi", - "libc", -] - [[package]] name = "num_enum" version = "0.5.7" @@ -2623,12 +2375,6 @@ dependencies = [ "libc", ] -[[package]] -name = "number_prefix" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" - [[package]] name = "objc" version = "0.2.7" @@ -2745,15 +2491,6 @@ dependencies = [ "syn", ] -[[package]] -name = "output_vt100" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "628223faebab4e3e40667ee0b2336d34a5b960ff60ea743ddfdbcf7770bcfb66" -dependencies = [ - "winapi", -] - [[package]] name = "pango-sys" version = "0.15.10" @@ -2795,12 +2532,6 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "path-slash" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e91099d4268b0e11973f036e885d652fb0b21fedcf69738c627f94db6a44f42" - [[package]] name = "peeking_take_while" version = "0.1.2" @@ -2882,18 +2613,6 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" -[[package]] -name = "pretty_assertions" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a25e9bcb20aa780fd0bb16b72403a9064d6b3f22f026946029acb941a50af755" -dependencies = [ - "ctor", - "diff", - "output_vt100", - "yansi", -] - [[package]] name = "primal-check" version = "0.3.1" @@ -3029,30 +2748,6 @@ dependencies = [ "cty", ] -[[package]] -name = "rayon" -version = "1.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d" -dependencies = [ - "autocfg", - "crossbeam-deque", - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f" -dependencies = [ - "crossbeam-channel", - "crossbeam-deque", - "crossbeam-utils", - "num_cpus", -] - [[package]] name = "redox_syscall" version = "0.2.15" @@ -3079,17 +2774,9 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" dependencies = [ - "aho-corasick", - "memchr", "regex-syntax", ] -[[package]] -name = "regex-automata" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" - [[package]] name = "regex-syntax" version = "0.6.27" @@ -3212,6 +2899,7 @@ dependencies = [ "embed-resource", "env_logger", "generational-arena", + "gilrs", "isahc", "log", "rfd", @@ -3224,15 +2912,6 @@ dependencies = [ "winit", ] -[[package]] -name = "ruffle_input_format" -version = "0.1.0" -dependencies = [ - "bitflags", - "serde", - "serde_json", -] - [[package]] name = "ruffle_macros" version = "0.1.0" @@ -3259,36 +2938,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "ruffle_render_canvas" -version = "0.1.0" -dependencies = [ - "fnv", - "js-sys", - "log", - "ruffle_render", - "ruffle_web_common", - "swf", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "ruffle_render_webgl" -version = "0.1.0" -dependencies = [ - "bytemuck", - "fnv", - "js-sys", - "log", - "ruffle_render", - "ruffle_web_common", - "swf", - "thiserror", - "wasm-bindgen", - "web-sys", -] - [[package]] name = "ruffle_render_wgpu" version = "0.1.0" @@ -3310,24 +2959,6 @@ dependencies = [ "wgpu", ] -[[package]] -name = "ruffle_scanner" -version = "0.1.0" -dependencies = [ - "clap", - "crossbeam-channel", - "csv", - "indicatif", - "log", - "path-slash", - "rayon", - "ruffle_core", - "serde", - "sha2", - "swf", - "walkdir", -] - [[package]] name = "ruffle_video" version = "0.1.0" @@ -3356,50 +2987,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "ruffle_web" -version = "0.1.0" -dependencies = [ - "base64", - "chrono", - "console_error_panic_hook", - "console_log", - "generational-arena", - "getrandom", - "js-sys", - "log", - "ruffle_core", - "ruffle_render_canvas", - "ruffle_render_webgl", - "ruffle_render_wgpu", - "ruffle_video_software", - "ruffle_web_common", - "serde", - "serde-wasm-bindgen", - "thiserror", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", -] - -[[package]] -name = "ruffle_web_common" -version = "0.1.0" -dependencies = [ - "js-sys", - "log", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "ruffle_web_safari" -version = "0.1.0" -dependencies = [ - "objc", -] - [[package]] name = "ruffle_wstr" version = "0.1.0" @@ -3451,6 +3038,17 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8" +[[package]] +name = "rusty-xinput" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2aa654bc32eb9ca14cce1a084abc9dfe43949a4547c35269a094c39272db3bb" +dependencies = [ + "lazy_static", + "log", + "winapi", +] + [[package]] name = "ryu" version = "1.0.10" @@ -3500,12 +3098,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" -[[package]] -name = "scoped_threadpool" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" - [[package]] name = "scopeguard" version = "1.1.0" @@ -3539,17 +3131,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde-wasm-bindgen" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cfc62771e7b829b517cb213419236475f434fb480eddd76112ae182d274434a" -dependencies = [ - "js-sys", - "serde", - "wasm-bindgen", -] - [[package]] name = "serde-xml-rs" version = "0.6.0" @@ -3580,7 +3161,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41feea4228a6f1cd09ec7a3593a682276702cd67b5273544757dae23c096f074" dependencies = [ "indexmap", - "itoa 1.0.2", + "itoa", "ryu", "serde", ] @@ -3606,17 +3187,6 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "sha2" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" -dependencies = [ - "cfg-if 1.0.0", - "cpufeatures", - "digest", -] - [[package]] name = "shlex" version = "1.1.0" @@ -3710,15 +3280,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "spin" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f6002a767bff9e83f8eeecf883ecb8011875a21ae8da43bffb817a57e78cc09" -dependencies = [ - "lock_api", -] - [[package]] name = "spirv" version = "0.2.0+1.5.4" @@ -3872,31 +3433,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "terminal_size" -version = "0.1.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "tests" -version = "0.1.0" -dependencies = [ - "approx", - "env_logger", - "futures", - "image", - "pretty_assertions", - "regex", - "ruffle_core", - "ruffle_input_format", - "ruffle_render_wgpu", -] - [[package]] name = "thiserror" version = "1.0.37" @@ -3917,26 +3453,6 @@ dependencies = [ "syn", ] -[[package]] -name = "threadpool" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" -dependencies = [ - "num_cpus", -] - -[[package]] -name = "tiff" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7259662e32d1e219321eb309d5f9d898b779769d81b76e762c07c8e5d38fcb65" -dependencies = [ - "flate2", - "jpeg-decoder", - "weezl", -] - [[package]] name = "time" version = "0.1.44" @@ -3954,7 +3470,7 @@ version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d634a985c4d4238ec39cacaed2e7ae552fbd3c476b552c1deac3021b7d7eaf0c" dependencies = [ - "itoa 1.0.2", + "itoa", "libc", "num_threads", "time-macros", @@ -4074,12 +3590,6 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0685c84d5d54d1c26f7d3eb96cd41550adb97baed141a761cf335d3d33bcd0ae" -[[package]] -name = "typenum" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" - [[package]] name = "unicode-bidi" version = "0.3.8" @@ -4130,6 +3640,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "uuid" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "feb41e78f93363bb2df8b0e86a2ca30eed7806ea16ea0c790d757cf93f79be83" + [[package]] name = "vcpkg" version = "0.2.15" @@ -4722,9 +4238,3 @@ name = "xml-rs" version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3" - -[[package]] -name = "yansi" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" diff --git a/Cargo.toml b/Cargo.toml index 14d866babb18..2f0745ac277e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,23 +4,23 @@ members = [ "core/macros", "core/build_playerglobal", "desktop", - "swf", - "web", - "web/packages/extension/safari", - "wstr", - "scanner", - "exporter", +# "swf", +# "web", +# "web/packages/extension/safari", +# "wstr", +# "scanner", +# "exporter", "render", - "render/canvas", +# "render/canvas", "render/wgpu", - "render/webgl", +# "render/webgl", - "video", - "video/software", +# "video", +# "video/software", - "tests", - "tests/input-format", +# "tests", +# "tests/input-format", ] resolver = "2" diff --git a/README.md b/README.md index 8085c002bf8f..f97a24e239bb 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,24 @@ -

- Ruffle -

-

- - Rust Build Status - Web Build Status - - - Ruffle npm - - - Ruffle AUR - - - Ruffle Discord - -
- website | demo | nightly builds | wiki -

- -# Ruffle - -Ruffle is an Adobe Flash Player emulator written in the Rust programming language. Ruffle targets both the desktop and the web using WebAssembly. +# Ruffle Game -## Project status +This 'game version' is meant to make it easier for Game Developers wanting to have gamepad / platform support (eg. Steam). +If no SWF is provided on the command-line, Ruffle Game will automatically run the Embedded SWF. -Ruffle is in the proof-of-concept stage and can currently run early Flash animations and games. Basic ActionScript 1.0/2.0 support is in place and improving; ActionScript 3.0 support is forthcoming. For more info, read the [project roadmap](https://github.com/ruffle-rs/ruffle/wiki/Roadmap). +Please see the [Companion App](https://github.com/cyraid/rgcompanion) to replace the Title, Icon, and +Embedded SWF. This will result in having a single standalone executable (like Adobe AIR but for Ruffle). -## Using Ruffle +## Project status -The easiest way to try out Ruffle is to visit the [web demo page](https://ruffle.rs/demo/), then click the "Browse..." button to load an SWF file of your choice. +* Gamepad support working. +* ExternalInterface support working. +* Steam (Under consideration) -[Nightly builds](https://ruffle.rs/#releases) of Ruffle are available for desktop and web platforms including the browser extension. +## Using Ruffle -For more detailed instructions, see our [wiki page](https://github.com/ruffle-rs/ruffle/wiki/Using-Ruffle). +* ExternalInterface + * ExternalInterface.call("print", [1, "2"]) + * ExternalInterface.addCallback("gamepad.onChange", function(gamepadId, buttonOrAxis, value) {}) + * Look at desktop/src/gamepad.rs for buttonOrAxis mappings. + * Value is true/false for buttons, and -1.0 to 1.0 for axis. ## Building from source @@ -41,7 +26,9 @@ For more detailed instructions, see our [wiki page](https://github.com/ruffle-rs You must also have Java installed, and available on your PATH as `java`. -### Desktop +"ruffle_desktop" will be the Game Player. + +### OS If you are building for a Linux platform, make sure that the GTK 3 development packages are installed on your system. (Ubuntu: `libgtk-3-dev`, Fedora: `gtk3-devel`) @@ -56,105 +43,24 @@ To run a specific SWF file, pass the SWF path as an argument: To build in debug mode, simply omit `--release` from the command. -## Homebrew - -Ruffle Desktop can be built from our [Homebrew Tap](https://github.com/ruffle-rs/homebrew-ruffle/): - -`brew install --HEAD ruffle-rs/ruffle/ruffle` - -_Note: because it is HEAD-only, you'll need to run `brew upgrade --fetch-HEAD ruffle` each time you want to update._ - -### Web or Extension - -Follow [the instructions in the web directory](web/README.md#building-from-source) for building -either the web or browser extension version of Ruffle. - -### Scanner - -If you have a collection of "real world" SWFs to test against, the scanner may be used to benchmark -ruffle's parsing capabilities. Provided with a folder and an output filename, it will attempt to read -all of the flash files and report on the success of such a task. - -`cargo run --release --package=ruffle_scanner -- folder/with/swfs/ results.csv` - -### Exporter - -If you have a swf and would like to capture an image of it, you may use the exporter tool. -This currently requires hardware acceleration, but can be run headless (with no window). - -- `cargo run --release --package=exporter -- path/to/file.swf` -- `cargo run --release --package=exporter -- path/to/file.swf path/to/screenshots --frames 5` - ## Structure -- `core` contains the core emulator and common code - `desktop` contains the desktop client (uses `wgpu-rs`) -- [`web`](web) contains the web client and browser extension (uses `wasm-bindgen`) -- `scanner` contains a utility to bulk parse swf files -- `exporter` contains a utility to generate PNG screenshots of a swf file - -## Sponsors - -You can support the development of Ruffle via [GitHub Sponsors](https://github.com/sponsors/ruffle-rs). Your sponsorship will help to ensure the accessibility of Flash content for the future. Thank you! - -Sincere thanks to the diamond level sponsors of Ruffle: - -

- - Newgrounds.com - - - CPMStar - - - Sébastien Bénard - - - Crazy Games - - - Cool Math Games - - - The New York Times - - - Armor Games - - - Onda Educa - - - TwoPlayerGames.org - - - wowgame.jp - - - Matt Roszak - - - Doll Divine - - - Movavi - -

## License -Ruffle is licensed under either of +Ruffle Game is licensed under either of - Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) - MIT License (http://opensource.org/licenses/MIT) at your option. -Ruffle depends on third-party libraries under compatible licenses. See [LICENSE.md](LICENSE.md) for full information. +Ruffle Game depends on third-party libraries under compatible licenses. See [LICENSE.md](LICENSE.md) for full information. ### Contribution -Ruffle welcomes contribution from everyone. See [CONTRIBUTING.md](CONTRIBUTING.md) for help getting started. +Ruffle Game welcomes contribution from everyone. See [CONTRIBUTING.md](CONTRIBUTING.md) for help getting started. Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be dual licensed as above, without any diff --git a/desktop/Cargo.toml b/desktop/Cargo.toml index 50759b61fcad..9c767e38fe80 100644 --- a/desktop/Cargo.toml +++ b/desktop/Cargo.toml @@ -9,6 +9,7 @@ license = "MIT OR Apache-2.0" [dependencies] clap = { version = "4.0.12", features = ["derive"] } cpal = "0.14.0" +gilrs = "0.9.0" ruffle_core = { path = "../core", features = ["audio", "symphonia", "nellymoser"] } ruffle_render_wgpu = { path = "../render/wgpu", features = ["clap"] } ruffle_video_software = { path = "../video/software", optional = true } diff --git a/desktop/assets/Placeholder.swf b/desktop/assets/Placeholder.swf new file mode 100644 index 000000000000..3d8401985ee8 Binary files /dev/null and b/desktop/assets/Placeholder.swf differ diff --git a/desktop/assets/ruffle_desktop.rc b/desktop/assets/ruffle_desktop.rc index e437f84cee27..92a0a27bb2b6 100644 --- a/desktop/assets/ruffle_desktop.rc +++ b/desktop/assets/ruffle_desktop.rc @@ -47,5 +47,11 @@ FILESUBTYPE VFT2_UNKNOWN } } +#define SWF_BLOB 0x200 +SWF_BLOB RCDATA "assets/Placeholder.swf" + +#define IDS_TITLE 0x201 +STRINGTABLE { IDS_TITLE, "Game" } + #define IDI_ICON 0x101 IDI_ICON ICON "assets/favicon.ico" diff --git a/desktop/src/external.rs b/desktop/src/external.rs new file mode 100644 index 000000000000..ecf8349ba45d --- /dev/null +++ b/desktop/src/external.rs @@ -0,0 +1,100 @@ +use ruffle_core::context::UpdateContext; +use ruffle_core::external::{ExternalInterfaceMethod, ExternalInterfaceProvider, Value as ExternalValue}; + +pub struct GameExternalInterfaceProvider { +} + +impl GameExternalInterfaceProvider { + + pub fn new() -> Self { + Self { + } + } + +} + +impl ExternalInterfaceProvider for GameExternalInterfaceProvider { + + fn get_method(&self, name: &str) -> Option> { + Some(Box::new(GameMethod::new(name.to_string()))) + } + + fn on_callback_available(&self, _name: &str) { + } + + fn on_fs_command(&self, command: &str, _args: &str) -> bool { + println!("command: {}", command); + false + } + +} + +struct GameMethod { + name: String, +} + +impl GameMethod { + + pub fn new(name: String) -> Self { + Self { + name, + } + } + + fn print_arg(&self, arg: &ExternalValue) { + match arg { + ExternalValue::Null => print!("{}", "NULL".to_string()), + ExternalValue::Bool(value) => print!("{}", value.to_string()), + ExternalValue::Number(value) => print!("{}", value.to_string()), + ExternalValue::String(value) => print!("\"{}\"", value.to_string()), + ExternalValue::List(values) => { + + let mut count = 0; + + print!("{}", "["); + + for value in values { + if count > 0 { print!("{}", ","); } + self.print_arg(value); + count = count + 1; + } + + print!("{}", "]"); + + }, + _ => print!("{}", "N/A".to_string()) + } + } + +} + +impl ExternalInterfaceMethod for GameMethod { + + fn call( + &self, + _context: &mut UpdateContext<'_, '_, '_>, + args: &[ExternalValue], + ) -> ExternalValue { + + match self.name.as_str() { + "test" => return ExternalValue::List(args.to_owned()), + "print" => { + + let mut count = 0; + + for arg in args { + if count > 0 { print!("{}", ","); } + self.print_arg(arg); + count = count + 1; + } + + println!("{}", ""); + + }, + _ => (), + } + + ExternalValue::Null + + } +} diff --git a/desktop/src/gamepad.rs b/desktop/src/gamepad.rs new file mode 100644 index 000000000000..25b9f7aaca77 --- /dev/null +++ b/desktop/src/gamepad.rs @@ -0,0 +1,97 @@ +use std::sync::{Arc, Mutex}; +use gilrs::{Axis, Button, Gilrs}; +use gilrs::EventType::{AxisChanged, ButtonPressed, ButtonReleased}; +use ruffle_core::Player; +use ruffle_core::external::{Value as ExternalValue}; + +pub struct Gamepad { + gilrs: Mutex, +} + +impl Gamepad { + + pub fn new() -> Self { + Self { + gilrs: Mutex::new(Gilrs::new().unwrap()), + } + } + + pub fn axis_to_str(&self, axis: Axis) -> String { + match axis { + Axis::LeftStickX => "lx", + Axis::LeftStickY => "ly", + Axis::LeftZ => "lz", + Axis::RightStickX => "rx", + Axis::RightStickY => "ry", + Axis::RightZ => "rz", + _ => "N/A" + }.to_string() + } + + pub fn button_to_str(&self, button: Button) -> String { + match button { + Button::DPadUp => "up", + Button::DPadLeft => "left", + Button::DPadRight => "right", + Button::DPadDown => "down", + Button::LeftTrigger => "l1", + Button::LeftTrigger2 => "l2", + Button::LeftThumb => "l3", + Button::RightTrigger => "r1", + Button::RightTrigger2 => "r2", + Button::RightThumb => "r3", + Button::Select => "select", + Button::Start => "start", + Button::North => "y", + Button::East => "b", + Button::South => "a", + Button::West => "x", + _ => "N/A" + }.to_string() + } + + pub fn handle_gamepad_input(&mut self, player: &Arc>) { + + let mut player_lock = player.lock().unwrap(); + let mut gilrs_lock = self.gilrs.lock().unwrap(); + + while let Some(ev) = gilrs_lock.next_event() { + + let gamepad_id: usize = usize::from(ev.id); + + match ev.event { + ButtonPressed(button, _code) => { + + player_lock.call_internal_interface("gamepad.onChange", [ + ExternalValue::from(gamepad_id), + ExternalValue::String(self.button_to_str(button)), + ExternalValue::Bool(true), + ]); + + }, + ButtonReleased(button, _code) => { + + player_lock.call_internal_interface("gamepad.onChange", [ + ExternalValue::from(gamepad_id), + ExternalValue::String(self.button_to_str(button)), + ExternalValue::Bool(false), + ]); + + }, + AxisChanged(axis, value, _code) => { + + player_lock.call_internal_interface("gamepad.onChange", [ + ExternalValue::from(gamepad_id), + ExternalValue::String(self.axis_to_str(axis)), + ExternalValue::from(value), + ]); + + }, + _ => () + } + + } + + } + +} diff --git a/desktop/src/main.rs b/desktop/src/main.rs index b5bd4c7cb10c..a51cef54c34d 100644 --- a/desktop/src/main.rs +++ b/desktop/src/main.rs @@ -5,6 +5,8 @@ // See https://docs.microsoft.com/en-us/cpp/build/reference/subsystem?view=msvc-160 for details. #![windows_subsystem = "windows"] +mod gamepad; +mod external; mod audio; mod custom_event; mod executor; @@ -13,12 +15,14 @@ mod storage; mod task; mod ui; +use gamepad::Gamepad; +use external::GameExternalInterfaceProvider; + use crate::custom_event::RuffleEvent; use crate::executor::GlutinAsyncExecutor; use anyhow::{anyhow, Context, Error}; use clap::Parser; use isahc::{config::RedirectPolicy, prelude::*, HttpClient}; -use rfd::FileDialog; use ruffle_core::{ config::Letterbox, events::KeyCode, tag_utils::SwfMovie, Player, PlayerBuilder, PlayerEvent, StageDisplayState, StaticCallstack, ViewportDimensions, @@ -29,15 +33,20 @@ use std::cell::RefCell; use std::io::Read; use std::path::{Path, PathBuf}; use std::rc::Rc; +use std::slice; use std::sync::{Arc, Mutex}; use std::time::Instant; use url::Url; +use winapi::shared::ntdef::LPWSTR; +use winapi::um::libloaderapi::{FindResourceW, FreeResource, GetModuleHandleW, LoadResource, LoadStringW, LockResource, SizeofResource}; +use winapi::um::winuser::{MAKEINTRESOURCEW, RT_RCDATA}; use winit::dpi::{LogicalSize, PhysicalPosition, PhysicalSize, Size}; use winit::event::{ ElementState, KeyboardInput, ModifiersState, MouseButton, MouseScrollDelta, VirtualKeyCode, WindowEvent, }; use winit::event_loop::{ControlFlow, EventLoop, EventLoopBuilder}; +use winit::platform::windows::IconExtWindows; use winit::window::{Fullscreen, Icon, Window, WindowBuilder}; thread_local! { @@ -141,18 +150,28 @@ fn parse_parameters(opt: &Opt) -> impl '_ + Iterator { }) } -fn pick_file() -> Option { - FileDialog::new() - .add_filter(".swf", &["swf"]) - .set_title("Load a Flash File") - .pick_file() -} - fn load_movie(url: &Url, opt: &Opt) -> Result { let mut movie = if url.scheme() == "file" { SwfMovie::from_path(url.to_file_path().unwrap(), None) .map_err(|e| anyhow!(e.to_string())) .context("Couldn't load swf")? + } else if url.scheme() == "res" { + + let instance = unsafe { GetModuleHandleW(std::ptr::null()) }; + let res_info = unsafe { FindResourceW(instance, MAKEINTRESOURCEW(0x200), RT_RCDATA) }; + let data_size = unsafe { SizeofResource(instance, res_info) }; + let res = unsafe { LoadResource(instance, res_info) }; + let data_ptr = unsafe { LockResource(res) as *const u8 }; + let buffer = unsafe { slice::from_raw_parts(data_ptr, data_size as usize) }; + + unsafe { + FreeResource(res); + } + + SwfMovie::from_data(&buffer, Some(url.to_string()), None) + .map_err(|e| anyhow!(e.to_string())) + .context("Couldn't load swf")? + } else { let proxy = opt.proxy.as_ref().and_then(|url| url.as_str().parse().ok()); let builder = HttpClient::builder() @@ -190,7 +209,7 @@ impl App { fn new(opt: Opt) -> Result { let path = match opt.input_path.as_ref() { Some(path) => Some(std::borrow::Cow::Borrowed(path)), - None => pick_file().map(std::borrow::Cow::Owned), + None => Some(std::borrow::Cow::Owned(PathBuf::from("res://SWFBLOB"))), }; let movie_url = if let Some(path) = path { Some(parse_url(&path).context("Couldn't load specified path")?) @@ -199,21 +218,21 @@ impl App { std::process::exit(0); }; - let icon_bytes = include_bytes!("../assets/favicon-32.rgba"); - let icon = - Icon::from_rgba(icon_bytes.to_vec(), 32, 32).context("Couldn't load app icon")?; - + let icon = Icon::from_resource(0x101, None).context("Couldn't load app icon")?; let event_loop = EventLoopBuilder::with_user_event().build(); - let title = if let Some(movie_url) = &movie_url { - let filename = movie_url - .path_segments() - .and_then(|segments| segments.last()) - .unwrap_or_else(|| movie_url.as_str()); + let title = { + + let mut buf: [u16; 1024] = [0; 1024]; + let instance = unsafe { GetModuleHandleW(std::ptr::null()) }; + let str_size = unsafe { LoadStringW(instance, 0x201, buf.as_mut_ptr() as LPWSTR, 1024) }; + + if str_size <= 0 { + String::from("Game") + } else { + String::from_utf16_lossy(&buf[0..str_size as usize]) + } - format!("Ruffle - {}", filename) - } else { - "Ruffle".into() }; let window = WindowBuilder::new() @@ -273,18 +292,15 @@ impl App { if let Some(movie_url) = movie_url { let event_loop_proxy = event_loop.create_proxy(); - let on_metadata = move |swf_header: &ruffle_core::swf::HeaderExt| { - let _ = event_loop_proxy.send_event(RuffleEvent::OnMetadata(swf_header.clone())); - }; + let movie = load_movie(&movie_url, &opt).unwrap(); + let _ = event_loop_proxy.send_event(RuffleEvent::OnMetadata(movie.header().clone())); + let mut player_lock = player.lock().unwrap(); - player.lock().unwrap().fetch_root_movie( - movie_url.to_string(), - parse_parameters(&opt).collect(), - Box::new(on_metadata), - ); + player_lock.add_external_interface(Box::new(GameExternalInterfaceProvider::new())); + player_lock.set_root_movie(movie); CALLSTACK.with(|callstack| { - *callstack.borrow_mut() = Some(player.lock().unwrap().callstack()); + *callstack.borrow_mut() = Some(player_lock.callstack()); }) } @@ -298,6 +314,7 @@ impl App { } fn run(self) -> ! { + let mut gamepad = Gamepad::new(); let mut loaded = false; let mut mouse_pos = PhysicalPosition::new(0.0, 0.0); let mut time = Instant::now(); @@ -308,6 +325,10 @@ impl App { // Poll UI events. self.event_loop .run(move |event, _window_target, control_flow| { + + // Handle Gamepad Input + gamepad.handle_gamepad_input(&self.player); + // Handle fullscreen keyboard shortcuts: Alt+Return, Escape. if let winit::event::Event::WindowEvent { event: WindowEvent::KeyboardInput { input, .. },