Skip to content

Commit

Permalink
ACTIONSCRIPT: Implement actionGetURL opcode
Browse files Browse the repository at this point in the history
  • Loading branch information
Nostritius authored and DrMcCoy committed Aug 28, 2018
1 parent 0e4596e commit bf4c5a3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/aurora/actionscript/asbuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ enum Opcodes {
kActionEnumerate2 = 0x55,
kActionStrictEquals = 0x66,
kActionExtends = 0x69,
kActionGetURL = 0x83,
kActionStoreRegister = 0x87,
kActionConstantPool = 0x88,
kActionDefineFunction2 = 0x8E,
Expand Down Expand Up @@ -141,6 +142,7 @@ void ASBuffer::execute(AVM &avm) {
case kActionCallMethod: actionCallMethod(avm); break;
case kActionEnumerate2: actionEnumerate2(); break;
case kActionExtends: actionExtends(); break;
case kActionGetURL: actionGetURL(avm); break;
case kActionStoreRegister: actionStoreRegister(avm); break;
case kActionDefineFunction2: actionDefineFunction2(); break;
case kActionConstantPool: actionConstantPool(); break;
Expand Down Expand Up @@ -505,6 +507,24 @@ void ASBuffer::actionExtends() {
debugC(kDebugActionScript, 1, "actionExtends");
}

void ASBuffer::actionGetURL(AVM &avm) {
const Variable url = _stack.top();
if (url.isString())
throw Common::Exception("actionGetURL: url is not a string");

This comment has been minimized.

Copy link
@darkstar

darkstar Sep 4, 2018

Contributor

I think either the exception message is wrong here, or there's a "!" missing in the if clause...

_stack.pop();
const Variable target = _stack.top();
if (target.isString())
throw Common::Exception("actionGetURL: target is not a string");

This comment has been minimized.

Copy link
@darkstar

darkstar Sep 4, 2018

Contributor

same here

_stack.pop();

const Common::UString urlString = url.asString();
const Common::UString targetString = target.asString();

avm.fsCommand(urlString, targetString);

debugC(kDebugActionScript, 1, "actionGetURL \"%s\" \"%s\"", urlString.c_str(), targetString.c_str());
}

void ASBuffer::actionStoreRegister(AVM &avm) {
byte registerNumber = _script->readByte();
avm.storeRegister(_stack.top(), registerNumber);
Expand Down
1 change: 1 addition & 0 deletions src/aurora/actionscript/asbuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class ASBuffer {
void actionCallMethod(AVM &avm);
void actionEnumerate2();
void actionExtends();
void actionGetURL(AVM &avm);
void actionStoreRegister(AVM &avm);
void actionConstantPool();
void actionDefineFunction2();
Expand Down

0 comments on commit bf4c5a3

Please sign in to comment.