Skip to content

Commit

Permalink
fix: Don't error on SetForegroundByThread or LogonToThread(0) (#285)
Browse files Browse the repository at this point in the history
Which fixes a bunch more cases of #202.
  • Loading branch information
tomsci authored Feb 18, 2024
1 parent 8bbb101 commit c613891
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ Various useful resources which aided greatly in reverse-engineering the OPL and
* http://www.koeniglich.de/epoc32_fileformats.txt
* https://frodo.looijaard.name/psifiles/MBM_File
* http://www.davros.org/psion/psionics/
* http://www.users.globalnet.co.uk/~datajam/opl-manual/html/opl/opchapt13.html

## Contributing

Expand Down
17 changes: 15 additions & 2 deletions src/opx/system.lua
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,16 @@ function RunExe(stack, runtime) -- 32
end

function LogonToThread(stack, runtime) -- 33
unimplemented("opx.system.LogonToThread")
local status = stack:pop():asVariable(DataTypes.ELong)
local id = stack:pop()
printf("LogonToThread(%d, %s)\n", id, status:addressOf())
if id == 0 then
-- Probably a follow on from a RunApp which we've already handled
status(KErrGenFail)
stack:push(0)
else
unimplemented("opx.system.LogonToThread")
end
end

function TerminateCurrentProcess(stack, runtime) -- 34
Expand Down Expand Up @@ -436,7 +445,11 @@ function SetBackground(stack, runtime) -- 56
end

function SetForegroundByThread(stack, runtime) -- 57
unimplemented("opx.system.SetForegroundByThread")
local prev = stack:pop()
local id = stack:pop()
printf("TODO: SetForegroundByThread(%d,%d)\n", id, prev)
stack:push(KErrGenFail)
-- unimplemented("opx.system.SetForegroundByThread")
end

function SetBackgroundByThread(stack, runtime) -- 58
Expand Down

0 comments on commit c613891

Please sign in to comment.