ruffle-rs / ruffle

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

New Club Penguin not supported ruffle player #8330

Closed deividbinev12 closed 4 months ago

deividbinev12 commented 2 years ago

Describe the bug

https://user-images.githubusercontent.com/80902993/196750362-eb8831bc-c234-41c8-aa41-40d783b669d0.mp4

it's not working, because this is multi files, this is actionsupport 3.0 i know ruffle player multiplayer is not working

Expected behavior

Screenshot 2022-10-19 192944 you know ''Download'' and ''Launch NewCP App'' it's can work with flash player, his server it's working

Affected platform

Browser's extension

Operating system

Windows 11

Browser

Edge

Additional information

from https://newcp.net/en/

Lord-McSweeney commented 1 year ago

Still not working. Direct SWF: https://media1.newcp.net/play/v2/client/club_penguin.swf Right now, it's erroring with Error dispatching event EventObject(EventObject { type: "addedToStage", class: flash.events::Event, ptr: 0xb78470 }) to handler FunctionObject(FunctionObject { ptr: 0xb77fb0 }) : RustError("Attempted to call \"\" with 1 arguments (more than 0 is prohibited)")

Lord-McSweeney commented 1 year ago

With #9647, this errors on ERROR ruffle_core::avm2::activation: ReferenceError: Error #1069: Property * not found on XMLList and there is no default value..

Lord-McSweeney commented 1 year ago

Now errors: Error: MainContext could not determine the locale for the specified langauge. Make sure that 'null' has been added to the switch..

AllinolCP commented 1 year ago

Now errors: Error: MainContext could not determine the locale for the specified langauge. Make sure that 'null' has been added to the switch..

This is related to flashvars not being provided (e.g. lang=en)

evilpie commented 1 year ago

I investigated this and made some progress, but got stuck at some point with something related to contextView. This game really needs a lot of stuff. What I've found:

Lord-McSweeney commented 1 year ago

This URL works for the page: https://play.newcp.net/eng/index.html#/login

Current errors:

Error dispatching `addedToStage` event : TypeError: Error #1009: Cannot access a property or method of a null object reference. (accessing field: getAVMBridge)
    at com.clubpenguin.main.overlays.mediator::MultipleOverlayViewMediator/onRegister()
    at org.robotlegs.base::MediatorBase/preRegister()
    at org.robotlegs.base::MediatorMap/registerMediator()
    at org.robotlegs.base::MediatorMap/createMediatorUsing()
    at org.robotlegs.base::MediatorMap/onViewAdded()
    at flash.display::DisplayObjectContainer/flash::display::DisplayObjectContainer::addChild()
    at com.clubpenguin.main::MainContext/startup()
    at org.robotlegs.mvcs::Context/checkAutoStartup()
    at org.robotlegs.mvcs::Context()
    at org.robotlegs.mvcs::SignalContext()
    at com.clubpenguin.main::MainContext()
    at com.clubpenguin.main::Main/init()
    at com.clubpenguin.main::Main/onAddedToStageHandler()

Error dispatching `addedToStage` event : TypeError: Error #1009: Cannot access a property or method of a null object reference. (accessing field: addChild)
    at com.clubpenguin.main.command::StartupCommand/execute()
    at org.robotlegs.base::SignalCommandMap/routeSignalToCommand()
    at MethodInfo-392()
    at org.osflash.signals::Signal/dispatch()
    at com.clubpenguin.main::MainContext/startup()
    at org.robotlegs.mvcs::Context/checkAutoStartup()
    at org.robotlegs.mvcs::Context()
    at org.robotlegs.mvcs::SignalContext()  at com.clubpenguin.main::MainContext()
    at com.clubpenguin.main::Main/init()
    at com.clubpenguin.main::Main/onAddedToStageHandler()

I would guess that the first error is because in the declaration

      [Inject]
      public var _model:MainModel;

The [Inject] isn't working correctly. (It should be handled by org.robotlegs, see https://www.oreilly.com/library/view/actionscript-developers-guide/9781449311193/ch04.html).

AllinolCP commented 1 year ago

for context Club Penguin uses robotlegs 1.4.0 amd swift suspenders 1.5.1

Lord-McSweeney commented 1 year ago

@AllinolCP pointed out on Discord that this is caused because of undocumented behavior in flash.utils.describeType, as describeType should also return <metadata> tags inside <variable> tags (if there is metadata). Example:

  ...
  <variable name="mc" type="flash.display::MovieClip">
    <metadata name="tag">
      <arg key="" value="value"/>
    </metadata>
    <metadata name="someOtherTag"/>
    <metadata name="tag">
      <arg key="dat" value="abcd"/>
    </metadata>
  </variable>
  ...

Which is returned by the property:

      [tag("value")]
      [someOtherTag]
      [tag(dat = "abcd")]
      public var mc:MovieClip;
Lord-McSweeney commented 1 year ago

According to Allinol, NCP loads a ZIP file and decompresses it, which takes some time in Ruffle. Next, it needs to load a file; that file is unforunately missing.

So a list of PRs that need to be merged for this:

elmemeee commented 1 year ago

has this been fixed? i have been waiting a long time but the only thing that is showing is a white screen.

SolsticeSpectrum commented 1 year ago

It still has problem with some language related stuff

ERROR core/src/avm2/events.rs:424 Error dispatching event EventObject(EventObject { type: "addedToStage", class: flash.events::Event, ptr: 0x127b638 }) to handler FunctionObject(FunctionObject { ptr: 0x127b130 }) : Error: MainContext could not determine the locale for the specified langauge. Make sure that 'null' has been added to the switch.
Lord-McSweeney commented 1 year ago

@DarkReaper231 You need to run it directly through the site, it uses flashvars. See https://github.com/ruffle-rs/ruffle/issues/8330#issuecomment-1475094475 @elmemeee If you bump the execution timeout, it gets as far as it would get on Flash. For some reason one of the necessary asset files is missing from the NewCP server.

Lord-McSweeney commented 11 months ago

The next issue seems to be that NCP calls External Interface with (function() { ... }) (or something similar, don't exactly remember what) as the argument. Ruffle doesn't support that yet.

SolsticeSpectrum commented 11 months ago

The next issue seems to be that NCP calls External Interface with (function() { ... }) (or something similar, don't exactly remember what) as the argument. Ruffle doesn't support that yet.

Is there a PR for implementation of it?

SolsticeSpectrum commented 5 months ago

@Lord-McSweeney What's the current status? All PRs that have been waiting for merge have been merged but the game still does not work.

Visiting through https://play.newcp.net/eng/index.html#/login instead of https://newcp.net/plays?force=true#/login no longer solves the issue with missing start_module.

Regarding the missing start_module, I was told this: the game would normally load world.swf instead of start module, however since the file does not exist the game will refuse to continue, it's programmed this way not a fault by ruffle And just to be clear, if Ruffle was to support AS3 -> AS2 LocalConnection communication and ExternalInterface fully, this would go away, I assume.

So when you first load up the game, it runs ExternalInterface (which isn't fully implemented) to get the URL's #path, where normally for world swf it has to be #/login, however since that failed it goes to a fallback which loads start_module.swf

Also seems like ExternalInterface spoofing is merged, idk what it means but yeah.

Dinnerbone commented 4 months ago

With LocalConnection (WIP local branch), this progresses but still doesn't get past a blue screen.

I can see that it's trying to show a login screen, but it just isn't :(

ChrisCPI commented 4 months ago

This isn't directly related to NewCP, but just thought it was worth pointing out. With the recent updates, I figured I'd test another CPPS that uses the AS3 client (https://play.cpimagined.net)

It does, in fact, get all the way to the login screen, but shows an error after a few seconds when trying to login, which I suppose was to be expected. image_2024-06-21_143606923 image_2024-06-21_143652026

AllinolCP commented 4 months ago

yes, because CPImagined would have to set up the WS proxy, the error shown was just shown to macOS users for some reason

Dinnerbone commented 4 months ago

With #16834 newcp.net works (assuming that someone sets up the WS proxy). Please open individual issues for any further bugs you find (or other sites if they have issues too, ofc)