Hiding high score data ( vaugly off topic )

OK… So now I have my game storing everything in the EXE, images and sounds (
tho still no joy hiding the icon for the window bar in a header
SDL_SetWMIcon(blah) only seems to like a .bmp from disk… ) and now what i am
wondering is about hiding the highscore somewhere,

i mean its quite pointlessish having everything neatly in one file if i have to
have an external high score file to read write, so, i’m wondering what the
viability would be to hide the highscore at the very end of the exe file and to
read write it from there, by say erm… not sure… this is probably a completley
insane idea as it could probably easilly corrupt the universe ( at least a
small point of it anyway ) dont know!

input anyone who has a clue about binary executables… at the moment i’m just in
windows land… but if this would work would it work across the OS board… i
assume at some point an exe file is told it has ended and i could poke a
highscore on the end.

thanks!

PS no advice about storing the highscore somewhere else or whatever, just
contributions to the proposal outlined please…

i assume most people on this list have me blacklisted as noobie spam… ;))

Unfortunately I don’t think you will be able to get that to work,
windows marks executable files as read only while a process is using
them. Of course, you could have 2 exes and use one to write the data
onto the other, but that would be as hard as trying to encrypt and
store it in a regular file. Even just compressing a high score text
file would be enough to fend off the average user, especially if you
rename the file to… I dont know a dll or something =)On 5/28/07, neil at cloudsprinter.com wrote:

OK… So now I have my game storing everything in the EXE, images and sounds (
tho still no joy hiding the icon for the window bar in a header
SDL_SetWMIcon(blah) only seems to like a .bmp from disk… ) and now what i am
wondering is about hiding the highscore somewhere,

i mean its quite pointlessish having everything neatly in one file if i have to
have an external high score file to read write, so, i’m wondering what the
viability would be to hide the highscore at the very end of the exe file and to
read write it from there, by say erm… not sure… this is probably a completley
insane idea as it could probably easilly corrupt the universe ( at least a
small point of it anyway ) dont know!

input anyone who has a clue about binary executables… at the moment i’m just in
windows land… but if this would work would it work across the OS board… i
assume at some point an exe file is told it has ended and i could poke a
highscore on the end.

thanks!

PS no advice about storing the highscore somewhere else or whatever, just
contributions to the proposal outlined please…

i assume most people on this list have me blacklisted as noobie spam… ;))


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Quoting Brian <brian.ripoff at gmail.com>:

Unfortunately I don’t think you will be able to get that to work,
windows marks executable files as read only while a process is using
them. Of course, you could have 2 exes and use one to write the data
onto the other, but that would be as hard as trying to encrypt and
store it in a regular file. Even just compressing a high score text
file would be enough to fend off the average user, especially if you
rename the file to… I dont know a dll or something =)

thanks, i thought as much, or similar ie something is gonna have a trip to the
psykee ward if you try to alter it while its running…

I guess i’m just gonna have to have a spare file…

still whats really bugging me is the WM Set icon thing, if you just whack a
SDL_LoadBMP(“blah.bmp”) it works fine, so i tried getting it read from const
memory an bmp i had bintohex’d and added in a header file but it didnt like it,
same as it didnt seem to accept a xpm, just to be sure i also set up so it loads
a bmp form const mem into a surface before i call WM set icon using that
surface… then thinking about it, perhaps i am relying on data that hasnt been
set by SDL video init stuff ( color key mask etc… ) but them the bmp i load
from disk would should be the same as the one i retrive from constant memory
right? dunno… i think i am out of my depth again…

(sink)

Have you looked at the structure of SDL_Surface? You should be able to
insert data into mySurface->w (width), mySurface->h (height) and
mySurface->pixels for example which would mean that SDL would then be
able to use that data to set the icon.

http://www.linuxjournal.com/article/4401 uncludes an example of drawing
direct to a surface.On Mon, 2007-05-28 at 16:08 +0100, neil at cloudsprinter.com wrote:

still whats really bugging me is the WM Set icon thing, if you just whack a
SDL_LoadBMP(“blah.bmp”) it works fine


Try the all-new Yahoo! Mail. “The New Version is radically easier to use” ? The Wall Street Journal
http://uk.docs.yahoo.com/nowyoucan.html

Does loading the bitmap data using SDL_RWops not work for you? Or how
are you trying to read it…

right i have it right now…

SDL_WM_SetIcon( IMG_LoadBMP_RW(SDL_RWFromConstMem(sez_bmp,
sizeof(sez_bmp) ) ),
NULL );

i wasnt using BMP load with the RW, so obviously it wasnt coping
loading a .bmp
file as it was an RWop

woe is me

still… perhaps i could hide my high score in a file that would serve as the
icon file . . . .

or not… i dont count how many times i have loaded the cygwin icon trying to
load cygwin…

thanks!

PS . I FREAKING HATE DEVELOPING ON WINDOWS IF FREAKING SUCKS WINDOWS XP HOME
1024 x 768 WRAAAGH GF’S COMPUTER NO ROOM FOR ANYMORE MUST COVERTLY ADD ANOTHER
HARDDISC AND DUAL BOOT SYSTEM BEFORE I THROW IT OUT THE WINDOW (oh the irony)

input anyone who has a clue about binary executables… at the moment i’m just in
windows land… but if this would work would it work across the OS board… i
assume at some point an exe file is told it has ended and i could poke a
highscore on the end.

You probably can’t reliably write to an .exe that is running, even if it
works in some versions of Windows.

If it isn’t running, you CAN write arbitrary data to the end of an .exe
without corrupting it…this is how self-extracting archives work…it’s
an .exe with an unzipper and a .zip file appended to the end of it. The
EXE has a header that lists its boundaries, and the .zip does the same
(and lists those boundaries at the end of the file so you can search
backwards).

So if writing to the .exe at runtime isn’t a problem, you could just
append 1024 zeroes to the end of it and use that space as your own.

PS no advice about storing the highscore somewhere else or whatever, just
contributions to the proposal outlined please…

Sorry, you’re getting the advice anyhow.

Do you REALLY want to do this? I see the value in getting everything
into one .exe so you can download and play immediately, but once you are
running, you might as well use the disk. Also, if the user upgrades to a
newer version, they’d lose their high scores (and preferences, save
games, etc…). Use the disk. It’s there to be used.

If you don’t want to look like you’re cluttering up the disk with files,
put the high scores in the Windows Registry. If you don’t want to do
that either, maybe post and retrieve them from a webserver that
maintains “global” high scores.

–ryan.

right i have it right now…

SDL_WM_SetIcon( IMG_LoadBMP_RW(SDL_RWFromConstMem(sez_bmp,
sizeof(sez_bmp) ) ),
NULL );

i wasnt using BMP load with the RW, so obviously it wasnt coping
loading a .bmp
file as it was an RWop

i’m still not sure why i can’t use an xpm for this…

unless my code for that was b0rk’d as well

i was using a function i either wrote or knabbed -

SDL_Surface *loadxpm(char **xpm)
{
SDL_Surface *surface;
SDL_Surface *image;
surface = IMG_ReadXPMFromArray(xpm);
SDL_SetColorKey(surface, SDL_SRCCOLORKEY,
SDL_MapRGB(surface->format,255,255,255));
image = SDL_DisplayFormat(surface);
SDL_FreeSurface(surface);

return image;

}

and something similar to

SDL_Surface *icon;
icon=loadxpm(blah_xpm);
SDL_WM_SetIcon( icon , NULL );

i’m guessing this might not work beacuse calls in loadxpm(char **xpm) relies on
stuff set when SDL init video stuff is called, so it cant set things becasue it
hasnt been told what they are yet…

neil at cloudsprinter.com wrote:

OK… So now I have my game storing everything in the EXE, images and sounds (
tho still no joy hiding the icon for the window bar in a header
SDL_SetWMIcon(blah) only seems to like a .bmp from disk… ) and now what i am
wondering is about hiding the highscore somewhere,

i mean its quite pointlessish having everything neatly in one file if i have to
have an external high score file to read write, so, i’m wondering what the
viability would be to hide the highscore at the very end of the exe file and to
read write it from there, by say erm… not sure… this is probably a completley
insane idea as it could probably easilly corrupt the universe ( at least a
small point of it anyway ) dont know!

input anyone who has a clue about binary executables… at the moment i’m just in
windows land… but if this would work would it work across the OS board… i
assume at some point an exe file is told it has ended and i could poke a
highscore on the end.

thanks!

PS no advice about storing the highscore somewhere else or whatever, just
contributions to the proposal outlined please…

i assume most people on this list have me blacklisted as noobie spam… ;))


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

if you do that (appending to .exe) every time the exe gets changed, my
firewall (kerio) would pop up and warn me about a modified executable.
that could be quite annoying over time…

[…]

if you do that (appending to .exe) every time the exe gets changed,
my firewall (kerio) would pop up and warn me about a modified
executable.
that could be quite annoying over time…

…and any serious virus scanner (with code inspection) would probably
go ballistic when users download the self modifying .exe. Also, some
systems may not allow ordinary users to modify executables at all.

This is really not the kind of stuff your average application should
be doing. Storing everything in a single file is fine, but modifying
executables is really a last resort thing, and usually a bad idea
anyway.

//David Olofson - Programmer, Composer, Open Source Advocate

.------- http://olofson.net - Games, SDL examples -------.
| http://zeespace.net - 2.5D rendering engine |
| http://audiality.org - Music/audio engine |
| http://eel.olofson.net - Real time scripting |
’-- http://www.reologica.se - Rheology instrumentation --'On Tuesday 29 May 2007, Andre Krause wrote:

PS no advice about storing the highscore somewhere else or whatever, just
contributions to the proposal outlined please…

Sorry, you’re getting the advice anyhow.

Do you REALLY want to do this? I see the value in getting everything
into one .exe so you can download and play immediately, but once you are
running, you might as well use the disk. Also, if the user upgrades to a
newer version, they’d lose their high scores (and preferences, save
games, etc…). Use the disk. It’s there to be used.

If you don’t want to look like you’re cluttering up the disk with files,
put the high scores in the Windows Registry. If you don’t want to do
that either, maybe post and retrieve them from a webserver that
maintains “global” high scores.

yea… i guess i’m just being a bit anal about getting everything into
one file-
just for the sake of it… so i’m thinking i just have a text file with the
highscore in and so it cant easilly be altered do someting cunning like alter
the ascii value of the numbers when written and put a random character
inbetween or something and a number at the end that checks the rest of the
numbers are right like on barcodes ( the name for this number escapes me right
now )

i’m so lazy i only ever think about keeping one score… the high score… but i
guess i should think about actually holding a high score table… as
for online
highscore, that would involve me doing what i dont know SDL_Net? ftp calls?

neil at cloudsprinter.com wrote:

yea… i guess i’m just being a bit anal about getting everything into
one file-
just for the sake of it… so i’m thinking i just have a text file with the
highscore in and so it cant easilly be altered do someting cunning like alter
the ascii value of the numbers when written and put a random character
inbetween or something and a number at the end that checks the rest of the
numbers are right like on barcodes ( the name for this number escapes me right
now )

i’m so lazy i only ever think about keeping one score… the high score… but i
guess i should think about actually holding a high score table… as
for online
highscore, that would involve me doing what i dont know SDL_Net? ftp calls?

Use curl and just do an http request, you really don’t want to write a
TCP or UDP based protocol for that.

Then you can use any webserver technology (ruby on rails, java, asp,
perl, whatever) to grab those high scores and store them in a db.

On the server side, you can also checks for wrong scores (like 2312
billions and max is 10 000).

Just a suggestion.

You can also write in an invisible file, or in the registry.

But, between you and me, writing a file called HighScores is fine. Write
it in binary format and 99% of your players won’t be able to edit it. If
you want to be sure nobody will be able to change it, but a scattered
checksum in the file. Like:

data checkSumForLastData data2 checkSumForFirstData data3
checkSumForLastData-1 …

Then, write yours values with a conversion table, and your file will be
hard to change.

Enjoy:P–
kuon

"Don’t press that button!"
http://goyman.com/

I myself have never used curl, but when I need a program to make a web
request (to send or retrieve data) I always use a program called wget and it
works great. It’s an open sourced utility found on many *nix operating
systems that’s ported to windows too. Real simple to find, real simple to
use (it’s command line operated).> ----- Original Message -----

From: sdl-bounces@lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On
Behalf Of kuon
Sent: Tuesday, May 29, 2007 8:06 AM
To: A list for developers using the SDL library. (includes SDL-announce)
Subject: Re: [SDL] hiding high score data ( vaugly off topic )

neil at cloudsprinter.com wrote:

yea… i guess i’m just being a bit anal about getting everything into
one file-
just for the sake of it… so i’m thinking i just have a text file with the
highscore in and so it cant easilly be altered do someting cunning like
alter
the ascii value of the numbers when written and put a random character
inbetween or something and a number at the end that checks the rest of the
numbers are right like on barcodes ( the name for this number escapes me
right
now )

i’m so lazy i only ever think about keeping one score… the high score…
but i
guess i should think about actually holding a high score table… as
for online
highscore, that would involve me doing what i dont know SDL_Net? ftp
calls?

Use curl and just do an http request, you really don’t want to write a
TCP or UDP based protocol for that.

Then you can use any webserver technology (ruby on rails, java, asp,
perl, whatever) to grab those high scores and store them in a db.

On the server side, you can also checks for wrong scores (like 2312
billions and max is 10 000).

Just a suggestion.

You can also write in an invisible file, or in the registry.

But, between you and me, writing a file called HighScores is fine. Write
it in binary format and 99% of your players won’t be able to edit it. If
you want to be sure nobody will be able to change it, but a scattered
checksum in the file. Like:

data checkSumForLastData data2 checkSumForFirstData data3
checkSumForLastData-1 …

Then, write yours values with a conversion table, and your file will be
hard to change.

Enjoy:P


kuon

"Don’t press that button!"
http://goyman.com/


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

kuon wrote:

neil at cloudsprinter.com wrote:

yea… i guess i’m just being a bit anal about getting everything into
one file-
just for the sake of it… so i’m thinking i just have a text file with the
highscore in and so it cant easilly be altered do someting cunning like alter
the ascii value of the numbers when written and put a random character
inbetween or something and a number at the end that checks the rest of the
numbers are right like on barcodes ( the name for this number escapes me right
now )

i’m so lazy i only ever think about keeping one score… the high score… but i
guess i should think about actually holding a high score table… as
for online
highscore, that would involve me doing what i dont know SDL_Net? ftp calls?

Use curl and just do an http request, you really don’t want to write a
TCP or UDP based protocol for that.

Then you can use any webserver technology (ruby on rails, java, asp,
perl, whatever) to grab those high scores and store them in a db.

On the server side, you can also checks for wrong scores (like 2312
billions and max is 10 000).

Just a suggestion.

You can also write in an invisible file, or in the registry.

But, between you and me, writing a file called HighScores is fine. Write
it in binary format and 99% of your players won’t be able to edit it. If
you want to be sure nobody will be able to change it, but a scattered
checksum in the file. Like:

data checkSumForLastData data2 checkSumForFirstData data3
checkSumForLastData-1 …

Then, write yours values with a conversion table, and your file will be
hard to change.

Enjoy:P

i use lincurl. its really easy with it to make an http post request and
submit scores to an php script and mysql db.

could you tell me more about a “conversion table” ? i have a rough idea,
but would be nice if you could explain in more detail. is it easy to
implement on server side (e.g. in php )?

Andre Krause wrote:

could you tell me more about a “conversion table” ? i have a rough idea,
but would be nice if you could explain in more detail. is it easy to
implement on server side (e.g. in php )

The conversion table was to store the high scores in a file.

You scramble the data so nobody can alter your file. That’s were
checksums and conversion comes.

The conversion is something like:

1 2 3 becomes 10 11 12 And you store that in the file, then you
checksum that data. That way, malicious users can’t just do an hexdump
with their high scores and change the value. You’ll tell me, there is
the checksum, yea, that one is often enough, but then, it was more like
a joke when I said all those things to scramble the data of your high
score file.

Regards–
kuon

"Don’t press that button!"
http://goyman.com/

SDL_Highscore.h anyone… ;))

Quoting kuon :> Andre Krause wrote:

could you tell me more about a “conversion table” ? i have a rough idea,
but would be nice if you could explain in more detail. is it easy to
implement on server side (e.g. in php )

The conversion table was to store the high scores in a file.

You scramble the data so nobody can alter your file. That’s were
checksums and conversion comes.

The conversion is something like:

1 2 3 becomes 10 11 12 And you store that in the file, then you
checksum that data. That way, malicious users can’t just do an hexdump
with their high scores and change the value. You’ll tell me, there is
the checksum, yea, that one is often enough, but then, it was more like
a joke when I said all those things to scramble the data of your high
score file.

Regards