See, I knew it was something glaringly obvious :p I normally use const char* if I'm not changing modifying the string, I have no idea why I didn't this time around so thanks :tup:
-Aura
EDIT:
#####
Is there any good guides online on data encryption? I want to use standard libraries if possible. I've done rot13 stuff but I've heard that bitwise operators can be used and I'm assuming theres other methods such as hashing, but I can't find any really good guides online.
02-04-2009, 12:44 PM
BenHur
open hidden files in flash0
I'm trying to read in the contents of "flash0:/kd/resource/big5_table.dat", but fd = sceIoOpen(filename, PSP_O_RDONLY, 0777); fails with fd = -2147418099.
Any clue why e.g. "flash0:/font/jpn0.pgf" can be opened and read without problems, but the above file cannot? Is it because it's hidden / in a hidden directory? Is there a workaround?
Thanks for the help, BenHur
PS: Sorry, if this was asked before - I searched for sceIoOpen failure reasons, but found nothing...
02-04-2009, 01:10 PM
Auraomega
I believe I've seen a post elsewhere on hidden folders/files causing a problem, I'm not 100% sure though. As for the error, could you supply it in hex format? It'd make debugging easier that way.
Also... weird question but have you tried re-mounting flash0? I know this works when modifying flash2 and flash3, so give that a shot too.
-Aura
02-04-2009, 01:11 PM
slicer4ever
Zitat:
Zitat von Auraomega
Is there any good guides online on data encryption? I want to use standard libraries if possible. I've done rot13 stuff but I've heard that bitwise operators can be used and I'm assuming theres other methods such as hashing, but I can't find any really good guides online.
i don't know about librarys(seems kindof pointless as any hacker could create a program which runs encrypted data though decrypters that use these librarys as a base point, and would immidiatly decrypt data encrypted with the library), i'd suggest building your own way to encrypt and decrypt data, isn't a hard thing to do, i've created an algorithm which scrambles/encrypts text based on offsetting, and the length of the string and it's position in the string
02-04-2009, 01:11 PM
Davee
You sure you have correct file permissions? I think that error is 0x8001000D which IIRC, means invalid file permissions.
02-04-2009, 01:21 PM
BenHur
Thanks for the replies. Yes it's error 0x8001000D (No file access permission). However, how do I change the permission (I only want to read the contents)?
I tried reassigning with
It is included in many of his applications such as VLF.
02-04-2009, 01:39 PM
BenHur
Zitat:
Zitat von Davee
Use vsh mode (0x0800) or load Alex's IOP.prx
It is included in many of his applications such as VLF.
I'll give it a try. Thanks a lot for your help!
02-04-2009, 03:01 PM
Auraomega
Zitat:
Zitat von slicer4ever
i don't know about librarys(seems kindof pointless as any hacker could create a program which runs encrypted data though decrypters that use these librarys as a base point, and would immidiatly decrypt data encrypted with the library), i'd suggest building your own way to encrypt and decrypt data, isn't a hard thing to do, i've created an algorithm which scrambles/encrypts text based on offsetting, and the length of the string and it's position in the string
What I meant by standard libraries is not having to download a tun of Windoze only or Linux only libraries, I want to use whatever is usable by all C++ (so I could write an encryption method on the PC, use it on Linux and run it on the PSP).
So, how do I go about making an encryption algorithm, which was the question at hand, the only info I've found on encryption is rot13 (which is both easy and pointles) and XOR.
-Aura
02-04-2009, 03:12 PM
slicer4ever
well as long as you don't use anything api specific, creating encryption is rather easy, just use your imagination on how to modify your data and bring it back from modification, use offsets, break int's down into unsigned char's, etc, etc, but like i said using an library for encryption makes it rather easy to decrypt your data
02-04-2009, 04:15 PM
Auraomega
Ok thanks, so basically evolve it from an XOR, and make sure everything is revsersable (so divisions aren't a good plan).
And as I said, I wanted to avoid using libraries aimed at encrpytion, by normal libraries I meant stdlib or fopen, something innocuous that could be used to aid encryption.
-Aura
02-04-2009, 04:20 PM
slicer4ever
ah, yes, exactly what you said, and division can be used, just make certain all the math you do in one direction for encryption you do in reverse for decryption properly
edit: i just re-read your first post about encryption, i thought u said u were looking for a good library, after re-reading i noticed u said guide, idk what i was thinking, my bad
02-04-2009, 04:49 PM
Auraomega
No problem, easily done.
Using division, wouldn't it be best to be avoided though? I mean something like 10/3 would return 3.33... but when you reverse it you'll get 9.99... instead of 10. A minor formality as you could get it to round up (but by default it would round down I believe) but surely the same problem could arrise but in such a way it transforms parts of the output?
Also, another random question. Is there a cross-platform graphics library that will allow me to put text on the screen? The only ones I've come across are for Windoze, and I split my time roughly half between my PC and my Linux box so I need something cross platform ideally.
Is there a cross platform method of making a frontend to my encryption? Something where I can select check boxes, type file addresses for the files in and out, and see a progress bar? Something tells me that'd be hard to get away with in SDL... :p
02-05-2009, 08:40 AM
slicer4ever
Zitat:
Zitat von Auraomega
EDIT2:
Is there a cross platform method of making a frontend to my encryption? Something where I can select check boxes, type file addresses for the files in and out, and see a progress bar? Something tells me that'd be hard to get away with in SDL... :p
using visual c# 2005 could make it easy for you to design such a thing
Note that you'll need to open-source it (probably under GPL) unless you wait for 4.5.0 (which should be out fairly soon)
02-05-2009, 11:39 AM
Auraomega
Liste der Anhänge anzeigen (Anzahl: 1)
Thanks, that looks good and I'm not too fussed about making stuff open source anymore, I actually make readable stuff now.
I've having a strange problem with some code I've written on Vista. When I compile and run everything works as expected, when I compiled and ran it on Ubuntu things started playing up, I've spent the past couple of hours trying to figure out why it runs on one system and not the other. I think I've worked out where the code goes up the spout, but I can't see a logical reason why it'd happen, so could you lend assistance?
I've attached the map and dump files, the map files you'll need a hex editor to read, the dump is integers. From what I can see, the map dimensions are read correctly the first time, but after it goes haywire. The first map reads perfectly but every map afterwards fails to load.
-Aura
02-05-2009, 02:26 PM
yaustar
Have you stepped through it with a debugger?
02-05-2009, 02:50 PM
slasher101
any1 have any working libcurl examples on psp?
i cant get any to work!
~!SlasheR!~
02-05-2009, 03:37 PM
Auraomega
I don't know what debuggers are open to me on Linux. From what I can see its purely problems with handling 2 digit numbers as all maps under 10x10 run fine, but when I use fscanf on anything above that, the errors occur. I'll take a look and see what there is in the way of debuggers.
-Aura
EDIT:
Confirmed - hard coding the dimensions fixes the problem on those maps, so something with the fscanf is failing. I'm going to slightly modify the map files and see if that fixes it.
Nope, changing the map files didn't work still having the same problem, downloading a debugger now hopefully that'll give some indication of whats going on.
02-05-2009, 04:12 PM
yaustar
What IDE are you using?
Are you reading in binary files or text files? If the latter, don't forget that Windows and Linux have different line endings. Also, don't forget that Linux has a case sensitive filesystem.
Try the InsightGDB debugger: http://sources.redhat.com/insight/
02-05-2009, 04:24 PM
Auraomega
I don't use IDE's... can't get to grips with them I prefer to dive into a makefile instead.
I'm reading in binary mode, and theres no line breaks, just a continuous line of "stuff". Check the files to see what I mean.
I've also noticed another problem, when I hard coded the map files, it loaded the first map file, the second one wouldn't load though it just closed after the first, again this isn't something that happens on Vista. I thought there wasn't supposed to be any differences between C++ on Windows and Linux's standard libraries :dry:
-Aura
Blah I haven't got a clue what I'm doing, is there any documentation on the website on what to do or something?
02-06-2009, 05:14 AM
_df_
Zitat:
Zitat von Auraomega
I don't use IDE's... can't get to grips with them I prefer to dive into a makefile instead.
whats a makefile got to do with using an ide? use both.
Zitat:
I've also noticed another problem, when I hard coded the map files, it loaded the first map file, the second one wouldn't load though it just closed after the first, again this isn't something that happens on Vista. I thought there wasn't supposed to be any differences between C++ on Windows and Linux's standard libraries :dry:
well I'd wager its more a problem with your code than the standard library.
but since you are not showing us the code its hard to say. I'd suggest not using any of the *scanf* functions.
02-06-2009, 05:27 AM
Auraomega
Zitat:
Zitat von _df_
whats a makefile got to do with using an ide? use both.
well I'd wager its more a problem with your code than the standard library.
but since you are not showing us the code its hard to say. I'd suggest not using any of the *scanf* functions.
I did show the code, check the spoiler on the first post on this problem, theres also the dump and map files.
Theres also no problem with my code per se, because it runs fine on Vista, surely cross platform code that runs on Vista would also run on Linux?
After more work, and with the aid of kuroneko, we've worked out that the y dimension is the one with the problems, the x dimension is read correctly at 48, yet the y always fails to read on my other maps.
And using fscanf is the easiest and most logical way for me, I'm reading an integer with either 1 or 2 digits, with an x inbetween, so fscanf(FILE, "%ix%i", *xDim, *yDim); seems the best way forward.
-Aura
EDIT:
Slightly modified my code to give a nicer layout in the dump, the new dump is in the spoiler below:
Theres obviously a difference between Windoze and Linux's standard libraries otherwise this would not happen.
02-06-2009, 06:44 AM
_df_
aah I see the code. Ill check it out.
if your reading bytes with fgetc why not just have
x = fgetc(mapFile);
y = fgetc(mapfile);
and avoid the craptasticness that is scanf set of functions?
again I'd still vote the problem is not with the linux std libs, if there were it would have been found out by now, but since nobody else is having the same problem with standard fopen/fread/fgetc functions as you are...
fwiw Im building on linux and windows for psp/gpx/pc on several projects and different machines/versions of windows (2k/xp, mingw,openwatcom,vc) and several flavours of linux without any problems with basic posix functions.
02-06-2009, 07:32 AM
Auraomega
I agree, but it simply doesn't make sense as to why it works on one system and not another. What I'm saying is I think theres a subtle difference between the two and I'm tripping up this difference.
As for fgetc, I'm reading either a single or two digit number, which means one or two bytes, fgetc just isn't going to cut it (yes I know I could read it into a string and atoi it). The simple case is, if I'm having this problem then I'd like to know WHAT the problem is so I can avoid it in the future.
Also, dunno if this is assosiated, but I wanted to compile someone in OGL but couldn't find the libraries and stuff, so I downloaded a NeHe tut and compiled that, except that doesn't seem to run as expected either. It was NeHe lesson 10 with SDL, I've tried compiling on my PC to see if its a code error but it can't find the links to GL_BGR or GL_BGR_EXT so I can't tell whats going on.
-Aura
02-06-2009, 08:01 AM
_df_
Zitat:
Zitat von Auraomega
As for fgetc, I'm reading either a single or two digit number, which means one or two bytes, fgetc just isn't going to cut it (yes I know I could read it into a string and atoi it). The simple case is, if I'm having this problem then I'd like to know WHAT the problem is so I can avoid it in the future.
so your using 1 or 2 bytes.. as in 1..99... say 99x99 = 5 bytes..
you could just use fgetc/fputc and have 255x255 in 2 bytes. fgetc will more than 'cut' it, I just dont think you understand what we are talking about.
02-06-2009, 09:28 AM
Auraomega
You're right, I don't have a clue. fgetc returns 1 byte of data, 99x99 is 5 bytes, each dimension would therefore be 2 bytes. Personally I can't see how fgetc is useful here. Maybe you'd like to give me a working example of how to use fgetc to read 2 bytes per dimension?
-Aura
02-06-2009, 01:12 PM
yaustar
The .map files you provided are text files, not binary.
02-06-2009, 01:39 PM
Auraomega
Huh, maybe my understanding of text and binary files are wrong but, if its not standard ascii characters and not readable by a text editor, its a binary file right? I mean I'm using 0x01, 0x02 and 0x03 a lot, from what I can see the only text is the first bit with the dimensions.
And now another problem has cropped up... I hard coded the dimensions, so the map loaded, but the second map fails to load at all. Running the string through a for loop and using sprintf it gives 1.map on the first go, 2.map on the second on Vista, but 11.map on Linux :Argh:
And now... to make issues even worse, Vista cannot see the folders on the memory card only Ubuntu can... great I can't even show you the code for the for loop -.-
-Aura
EDIT:
Backed up the files and formatted the SD, anyway the code for that loop is below:
A couple of questions, the bool type, is that only 1 bit, or is it actually a byte (seems most likely) acting as a bit that can only have 2 states (true and false)?
ASM being hardware specific, does that mean that PC games are not coded in ASM as it would be different for each setup? To inline ASM into a C++ project I should use __asm{ } right?
Are there any good compression guides out there? I'm looking to add compression to my encryption and a quick Google search didn't return much useful.
-Aura
02-08-2009, 08:41 AM
yaustar
Zitat:
Zitat von Auraomega
Huh, maybe my understanding of text and binary files are wrong but, if its not standard ascii characters and not readable by a text editor, its a binary file right?
The files that you provided were readable by a text editor. If it wasn't a standard text file, then you wouldn't have been able to use fscanf formatting in the first place.
Binary files are generally illegible when opened in notepad. A .doc file is binary file. A .txt file is also a binary file. They are just both 'readable' when opened by the right program.
02-08-2009, 12:05 PM
Auraomega
When I open my map files in notepad they won't work, you sure you didn't check my dump? I did dump that in readable format. Well it opens in a text editor, but its just a bunch of white spaces and ¬ at 90 degrees. I thought binary files were anything that didn't contain the standard ASCII letters, or does it cover the full range of ASCII (0-255) even though some don't actually appear on screen?
-Aura
02-08-2009, 02:21 PM
yaustar
I opened 2.map and got
Code:
48x27
Ah, you have data pass the 48x27 which my text editor doesn't show but the copy and paste does. Joy. In which case, it is game on, now I can try it for myself.
My preliminary guess is that it is reading the bytes after '7' as part of the number until it hits a delimiter (eg a 0 byte). Don't forget the ASCII table values are between 0-255 so technically, every byte in a file can be represented by an ASCII character. As far as fscanf is concerned, it probably sees everything pass the 'x' as one really long string and attempts to convert it to an integer which it can't hence 0?
Stick a zero byte after the '7' and see what happens.
If you map sizes are not going to be bigger then 255x255, then you can store the dimensions in the first 2 bytes of the file rather then having it in plain text.
-=Double Post Merge =-
Plain text = human readable
Binary = Not human readable
Not all of the ASCII table is human readable.
02-08-2009, 04:05 PM
Auraomega
I see, sorry its been a while since I saw an ASCII table, after looking at one the last readable value is 127, I had it in my head that it spanned all 256.
As for the problem, we've discovered the problem, apparently the first map had a corrupted byte at the end, 0x0A, which is unaccounted for, this somehow caused yDim to become 0 on Ubuntu but not on Windows, and I have a feeling its because of a buffer overflow in the read function, after reviewing the code (something I should have done after digging up this half finished project) I noticed that the buffer was also getting the EOF on the end, the buffer was 48*27 - the biggest map size - so when it read 48*27 plus the EOF, it knocked the yDim (I assume) to 0, and also the stage to 0 when the last bit wasn't corrupted, which would also explain why the map continously reset itself to 1.map on Ubuntu but not Windows.
The subtle difference between to two? I'm assuming its only on memory.
-Aura
02-08-2009, 06:25 PM
NoEffex
Does anybody know a method of using a malloc-type action in kernel mode? It's been driving me insane looking for how malloc in itself would be able to derive from heap functions.
02-08-2009, 06:57 PM
Auraomega
In pspsysmem_kernel.h the function void *sceKernelAllocHeapMemory (SceUID heapid, SceSize size); should do what you require.
You'll have to allocate a heap yourself though, unless anyone here knows how to access already created heaps? You know, like the on you define at the start of your code for KB, can't think of the precompiler for it, or for calling on ones in other modules that you haven't got the address for?
-Aura
02-08-2009, 07:20 PM
NoEffex
Zitat:
Zitat von Auraomega
In pspsysmem_kernel.h the function void *sceKernelAllocHeapMemory (SceUID heapid, SceSize size); should do what you require.
You'll have to allocate a heap yourself though, unless anyone here knows how to access already created heaps? You know, like the on you define at the start of your code for KB, can't think of the precompiler for it, or for calling on ones in other modules that you haven't got the address for?
-Aura
Fair enough, a macro for that wouldn't be hard.
HEAP_SIZE_KB I believe is the word you're looking for.
02-11-2009, 08:36 AM
Gladiator
Hello, I've a question about a menu...
I do some menues with pspDebugScreenPrintf to show text in screen, but when I do this, to change selected option, I've to clear screen and show other selected menu, and it blink, how I can do a menu with debug functions without blink it?
Thx. Gladiator
02-11-2009, 12:12 PM
Auraomega
Use the GU or something thats double buffered (that way you're not drawing directly on the screen). graphics.c examples on PSP-Programming or OSLib should do that nicely. I'd also suggest using intraFont for a more "professional" look, as it uses the Sony font files.