ruffle-rs / ruffle

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

Unable to load any swf in https://chat.kongregate.com/flash/GameShell.swf #12261

Open Matrix4348 opened 1 year ago

Matrix4348 commented 1 year ago

Describe the bug

Opening https://chat.kongregate.com/flash/GameShell.swf?api_path=%2Fflash%2FAPI.swf&game_swf=http%3A%2F%2Fchat.kongregate.com%2Fgamez%2F0000%2F9480%2Flive%2Fdoeo_kong.swf results in a black screen.

Expected behavior

Doeo should be able to load inside this "game shell". Actually, any swf hosted on Kongregate should be able to, I only chose Doeo as an example.

Affected platform

Browser's extension

Operating system

Windows 8.1

Browser

All

Additional information

Player Info

Allows script access: false Renderer: wgpu Adapter Backend: Gl Adapter Name: "ANGLE (Google, Vulkan 1.3.0 (SwiftShader Device (Subzero) (0x0000C0DE)), SwiftShader driver)" Adapter Device Type: Cpu Adapter Driver Name: "" Adapter Driver Info: "" Enabled features: Features(TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES | PUSH_CONSTANTS) Available features: Features(TEXTURE_COMPRESSION_BC | TEXTURE_COMPRESSION_ETC2 | TEXTURE_COMPRESSION_ASTC | TEXTURE_COMPRESSION_ASTC_HDR | CLEAR_TEXTURE | MULTIVIEW) Current limits: Limits { max_texture_dimension_1d: 8192, max_texture_dimension_2d: 8192, max_texture_dimension_3d: 2048, max_texture_array_layers: 256, max_bind_groups: 4, max_bindings_per_bind_group: 640, max_dynamic_uniform_buffers_per_pipeline_layout: 8, max_dynamic_storage_buffers_per_pipeline_layout: 0, max_sampled_textures_per_shader_stage: 16, max_samplers_per_shader_stage: 16, max_storage_buffers_per_shader_stage: 0, max_storage_textures_per_shader_stage: 0, max_uniform_buffers_per_shader_stage: 11, max_uniform_buffer_binding_size: 16384, max_storage_buffer_binding_size: 0, max_vertex_buffers: 8, max_buffer_size: 268435456, max_vertex_attributes: 16, max_vertex_buffer_array_stride: 255, min_uniform_buffer_offset_alignment: 256, min_storage_buffer_offset_alignment: 256, max_inter_stage_shader_components: 60, max_compute_workgroup_storage_size: 0, max_compute_invocations_per_workgroup: 0, max_compute_workgroup_size_x: 0, max_compute_workgroup_size_y: 0, max_compute_workgroup_size_z: 0, max_compute_workgroups_per_dimension: 0, max_push_constant_size: 96 } Surface quality: high Surface samples: 4 Surface size: Extent3d { width: 550, height: 400, depth_or_array_layers: 1 }

Page Info

Page URL: chrome-extension://donbcfbmhbcapadipfkeojnmajbakjdc/player.html?url=https%3A%2F%2Fchat.kongregate.com%2Fflash%2FGameShell.swf%3Fapi_path%3D%252Fflash%252FAPI.swf%26game_swf%3Dhttp%253A%252F%252Fchat.kongregate.com%252Fgamez%252F0000%252F9480%252Flive%252Fdoeo_kong.swf%253Fkongregate_game_version%253D1209776882 SWF URL: https://chat.kongregate.com/flash/GameShell.swf?api_path=%2Fflash%2FAPI.swf&game_swf=http%3A%2F%2Fchat.kongregate.com%2Fgamez%2F0000%2F9480%2Flive%2Fdoeo_kong.swf%3Fkongregate_game_version%3D1209776882

Browser Info

User Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36 Edg/109.0.1518.115 Platform: Win32 Has touch support: false

Ruffle Info

Version: 0.1.0 Name: nightly 2023-07-22 Channel: nightly Built: 2023-07-22T00:19:38.712Z Commit: 77c0dac64be338500e8dbba1d8ad37d13a10cb5b Is extension: true

Metadata

width: 500 height: 500 frameRate: 24 numFrames: 1 swfVersion: 8 backgroundColor: #000000 isActionScript3: false uncompressedLength: 7158

Matrix4348 commented 1 year ago

I forgot to add that the errors in the web console, oups:

WARN core/src/stub.rs:126 Encountered stub: AVM1 System.security.allowDomain()
WARN core/src/stub.rs:126 Encountered stub: AVM1 System.security.allowInsecureDomain()
Lord-McSweeney commented 1 year ago

This is probably because AVM1 doesn't yet set query parameters as flashvars (see #11497).

n0samu commented 1 year ago

This is actually caused by the way that the API SWFs load other SWFs. Here's the relevant code from GameShell.swf:

    static var API_PATH = _root.api_path;
    static var API_LEVEL = "_level37200";
    // ... snip ...
        var _loc2_ = new MovieClipLoader();
        _loc2_.loadClip(ShellBootstrap.API_PATH,ShellBootstrap.API_LEVEL);

And here's the relevant code from API.swf (loaded by GameShell.swf):

var _loc3_ = new MovieClipLoader();
_loc3_.loadClip(_global.kongregate_vars.game_swf,"_level0");

This doesn't work because Ruffle doesn't handle "_level" strings in the target parameter of MovieClipLoader.loadClip(). See #12820.