ruffle-rs / ruffle

A Flash Player emulator written in Rust
https://ruffle.rs
Other
15.18k stars 784 forks source link

Gaia Aquarium Bugs #14455

Open TylerMcIntyre opened 7 months ago

TylerMcIntyre commented 7 months ago

Describe the bug

In Gaia Aquarium, you cannot tap the tank, click on the overseer for the daily gift (or the lucky chest for that matter) and you can't select the "Message in a Bottle feature, just crashes the Aquarium, and name each individual fish.

https://www.youtube.com/watch?v=F97tm6Af7m0 For video of bugs.

Expected behavior

https://www.youtube.com/watch?v=K4zlcpClMSk

Content Location

http://www.gaiaonline.com/aquarium

Affected platform

Desktop app

Operating system

Windows 11 Build 25982.1000

Browser

Google Chrome Version 118.0.5993.117 (Official Build) (64-bit)

Additional information

No response

adrian17 commented 4 months ago

Logs:

New Ruffle instance created (Version: nightly 2024-02-22 | WebAssembly extensions: ON | Used renderer: wgpu-webgl) ruffle.js:4460:17
Loading SWF file http://graphics.gaiaonline.com/images/Gaia_Flash/aquarium/Aquarium.swf?launchLotto=&userEnvironmentId=7048149&gsiUrl=www&firstTime=&location=mygaia&version=133 ruffle.js:4618:25
INFO core/src/context.rs:357 Loaded SWF version 9, resolution 941x768 @ 24 FPS 69.js:1021:21
WARN core/src/stub.rs:144 Encountered stub: AVM2 flash.utils.Dictionary constructor with weak keys 69.js:1021:21
WARN core/src/stub.rs:144 Encountered stub: AVM2 flash.display.Loader.load() addChild at the correct time 69.js:1021:21
WARN core/src/stub.rs:144 Encountered stub: AVM2 flash.display.MovieClip.goto() with SWF 9 movie 69.js:1021:21
WARN core/src/stub.rs:144 Encountered stub: AVM2 flash.system.Capabilities.language getter 69.js:1021:21
WARN core/src/stub.rs:144 Encountered stub: AVM2 flash.display.InteractiveObject.tabIndex setter 69.js:1021:21
WARN core/src/stub.rs:144 Encountered stub: AVM2 flash.display.DisplayObjectContainer.tabChildren setter 69.js:1021:21
WARN core/src/stub.rs:144 Encountered stub: AVM2 flash.display.DisplayObjectContainer.tabChildren getter 69.js:1021:21
WARN core/src/stub.rs:144 Encountered stub: AVM2 flash.text.TextField.mouseWheelEnabled setter 69.js:1021:21
WARN core/src/avm2/globals/flash/display/display_object_container.rs:184 Display object container has no child with name selectedUpSkin 69.js:1021:21
WARN core/src/avm2/globals/flash/display/display_object_container.rs:184 Display object container has no child with name selectedUpIcon 69.js:1021:21
WARN core/src/stub.rs:144 Encountered stub: AVM2 flash.display.InteractiveObject.tabEnabled getter 69.js:1021:21
WARN core/src/stub.rs:144 Encountered stub: AVM2 flash.system.Security.allowDomain() 69.js:1021:21
WARN core/src/stub.rs:144 Encountered stub: AVM2 flash.display.Graphics.drawRoundRectComplex() 69.js:1021:21
WARN core/src/stub.rs:144 Encountered stub: AVM2 flash.net.sendToURL() 69.js:1021:21
WARN core/src/stub.rs:144 Encountered stub: AVM2 flash.net.SharedObject.objectEncoding setter 69.js:1021:21
WARN core/src/stub.rs:144 Encountered stub: AVM2 flash.display.BitmapData.generateFilterRect() 69.js:1021:21
WARN core/src/stub.rs:144 Encountered stub: AVM2 flash.display.LoaderInfo.parentAllowsChild getter 69.js:1021:21
WARN core/src/stub.rs:144 Encountered stub: AVM2 flash.display.LoaderInfo.childAllowsParent getter 69.js:1021:21
ERROR core/src/avm2/events.rs:428 Error dispatching event EventObject(EventObject { type: "init", class: flash.events::Event, ptr: 0x31e9100 }) to handler FunctionObject(FunctionObject { ptr: 0x2aa69b0, name: Ok("mx.managers::SystemManager/initHandler()") }) : TypeError: Error #1009: Cannot access a property or method of a null object reference. (accessing field: mx.core:ISWFBridgeGroup::parentBridge)
    at mx.managers::SystemManager/initHandler() 69.js:1021:21

(everything up to the error happened on load, error happen when clicking the message button)

adrian17 commented 4 months ago

Looking at the mx.managers.SystemManager class, it's entirely possible this is just caused by one of our stubs - for example, I see a direct path between parentAllowsChild/childAllowsParent and making swfBridgeGroup (which is queried for parentBridge) non-null.

TylerMcIntyre commented 4 months ago

Please let me know when the fix has been implemented so I can tell the website owner to embed the code once updated.

TylerMcIntyre commented 3 months ago

Looking at the mx.managers.SystemManager class, it's entirely possible this is just caused by one of our stubs - for example, I see a direct path between parentAllowsChild/childAllowsParent and making swfBridgeGroup (which is queried for parentBridge) non-null.

Hello there. I won't ask again after this, is there any update to this at all? Thank you for taking the time to look into this.

Dinnerbone commented 3 months ago

For developers who want to test in Desktop, you need to extract the gaia55_sid cookie from the browser and then apply it like so:

diff --git a/desktop/src/backends/navigator.rs b/desktop/src/backends/navigator.rs
index c05d8036e..f52c2c329 100644
--- a/desktop/src/backends/navigator.rs
+++ b/desktop/src/backends/navigator.rs
@@ -8,7 +8,8 @@ use async_net::TcpStream;
 use futures::future::select;
 use futures::{AsyncReadExt, AsyncWriteExt};
 use futures_lite::FutureExt;
-use isahc::http::{HeaderName, HeaderValue};
+use isahc::cookies::Cookie;
+use isahc::http::{HeaderName, HeaderValue, Uri};
 use isahc::{
     config::RedirectPolicy, prelude::*, AsyncBody, HttpClient, Request as IsahcRequest,
     Response as IsahcResponse,
@@ -73,7 +74,20 @@ impl<F: FutureSpawner> ExternalNavigatorBackend<F> {
             .cookies()
             .redirect_policy(RedirectPolicy::Follow);

-        let client = builder.build().ok().map(Rc::new);
+        let mut client = builder.build().ok().map(Rc::new);
+
+        client
+            .as_mut()
+            .unwrap()
+            .cookie_jar()
+            .unwrap()
+            .set(
+                Cookie::builder("gaia55_sid", "xxxxxxxxxxxxxxxxxxxxx")
+                    .build()
+                    .unwrap(),
+                &Uri::from_static("http://www.gaiaonline.com/chat/gsi/index.php"),
+            )
+            .unwrap();

         // Force replace the last segment with empty. //

(Note that the swf url to load is whatever http://www.gaiaonline.com/aquarium loads - it contains a userid I think, so grab the url yourself)

Dinnerbone commented 3 months ago

image

If we force parentAllowsChild and childAllowsParent to make it take the "bridge" branch then this does progress - I'm not sure if that's just patching over the issue, or if that other branch is broken in Flash too.

TylerMcIntyre commented 3 months ago

So it turns out you can technically "tap the tank" but only just to an extent, just learned this yesterday. Just can't tap anywhere else. But the function is there. You can also tap the bottom left to the inventory just on the outside.

https://www.youtube.com/watch?v=pNZ_kPlynDQ

@Dinnerbone

Aaron1011 commented 2 months ago

New code for applying cookie:

        let cookies = Jar::default();
        cookies.set_cookies(
            &mut [&HeaderValue::from_static(
                "gaia55_sid=SID_COOKIE_VALUE;",
            )]
            .into_iter(),
            &Url::parse("http://www.gaiaonline.com/chat/gsi/index.php").unwrap(),
        );
        let mut builder = reqwest::ClientBuilder::new().cookie_provider(Arc::new(cookies));