[Scummvm-devel] Broken Sword 2.5 engine

yotam barnoy yotambarnoy at gmail.com
Tue Oct 19 23:40:39 CEST 2010


I was able to do a little more experimentation once I got home. Turns
out lua doesn't call socket stuff. I think the issue is that it calls
some libc functions that cause libc to be imported completely,
including sockets functions. The sockets parts of libc call the PSP
netlib functions, which were not included in the main executable.

It also turns out that the solution I suggested as a slim chance
actually works. I created dummy functions to make sure the problematic
objects get loaded into the main executable. When the plugins are
linked, they find all the symbols they need (not the PSP lib functions
themselves, but the functions that call those functions) inside the
main executable.

This solution should work in theory if we have lua linked in as a
library as well. However, seeing as lua in its current form uses many
C functions that replicate our functionality, I'm now leaning more
towards integrating it into our tree as if it were any other
interpreter. Just as an example, the PSP has special code allowing it
to resume from suspension when using our OSystem filesystem calls.
This won't work for BS2.5 ie. suspending the PSP will cause a crash.

Mind you, I have yet to check what the game looks like on the PSP --
it may not be worth the effort to satisfy its particular demands.

Yotam


On Tue, Oct 19, 2010 at 11:15 PM, Eugene Sandulenko <sev at scummvm.org> wrote:
> On Tue, 19 Oct 2010 16:58:20 +0200
> yotam barnoy <yotambarnoy at gmail.com> wrote:
>
>> Additionally, lua references clock() and rename() instead of
>> corresponding functionality in our base code. It also calls socket
>> functions, which should be completely removed. All of these currently
>> require linking the PSP plugins with extra, mostly unneeded libraries.
> We have 2 options on the plate:
>  - Remove Lua from our tree completely and rely on it as an external
>    library. But I think that in this case we're going back to the same
>    problem, i.e. PSP cannot call libraries out of plugins
>  - Remove that functionality from our Lua. Neither is used by Sword25.
>
>> > Rather than conditionally adding -lpng to the plugin link flags, I
>> > think it would be nicer if the PNG loading went through the common
>> > graphics code, like for example the JPEG code in graphics/.
>> >
>> > In addition to this, it'd be nice if the PNG writing code from
>> > Sword25::Screenshot::SaveToFile() would use the existing thumbnail
>> > code instead.
>> >
>> >
>> > Can someone from this engine please comment on the feasibility of
>> > the above?   Thanks.
> I see no problem with moving that PNG loader to our common code. As of
> thumbnails, Paul could reply on that.
>
> Also I don't really like current screenshot handling code since it has
> a whole screen copy into temporary bugger on every frame. I.e. we're
> shuffling around almost 2MB of data on every frame (800*600*4). That
> should've been slowing down things tremendously.
>
>
> Eugene
>




More information about the Scummvm-devel mailing list