I got another serious problem! I'm trying to read the TIM file using this code:
Code: Select all
if (CdSearchFile(&file,"\\LOGO.TIM;1") {
CdReadFile("\\LOGO.TIM;1",TIMLogo,nbyte)
CdReadSync(0,0);
}
Code: Select all
if (CdSearchFile(&file,"\\LOGO.TIM;1") {
CdReadFile("\\LOGO.TIM;1",TIMLogo,nbyte)
CdReadSync(0,0);
}
Ok... I replaced:Shadow wrote: ↑August 29th, 2019, 8:21 am Turn on compiler warnings. You're missing a closing bracket at the end of the first statement.
TIMLogo should be hopefully defined as an unsigned long pointer (you should use malloc for better memory management but that can be worked in later if need be).
Don't use nbyte. Use &fp.size (but it must be a multiple of 2048 so it's probably safer to just set nbyte to 0).
Code: Select all
u_long *TIMLogo;
Code: Select all
unsigned long TIMLogo[16384];
Code: Select all
CdReadFile("\\LOGO.TIM;1",TIMLogo[0],&file.size);
Code: Select all
CdlFILE file;
Code: Select all
passing arg 3 of "CdReadFile" makes integer from pointer...
Code: Select all
(int)&file.size
Code: Select all
&file.size
Code: Select all
16384
Ok fine, I'll stop asking for help, if you don't! This is it! I'll go myself, no one believe me I'm new!Yagotzirck wrote: ↑August 30th, 2019, 10:13 pm Judging from the source you posted, you're trying to read a TIM image by merely compiling the code without creating any disc image whatsoever... If you aren't that familiar with creating psx disc images you're better off embedding the TIM file inside the exe.
Also I don't understand why you're allocating 2048 * 4 = 8 KB for the TIMLogo buffer when the tim image itself is 600 KB?
Seriously dude, you look like a hunter who randomly shoots in the air hoping to hit some ducks - stop blindly modifying examples hoping for them to work, read the docs/do some research/strengthen your C knowledge instead of randomly adding stuff and asking for help here for every single thing that doesn't work.
You could keep doing this, but you wouldn't be doing yourself any favour since you aren't learning to approach and solve problems on you own, you're merely delegating the problem's solution to someone else every single time.
Now keep in mind that I'm not telling you to stop asking for help, I'm telling you to at least put some effort on things before immediately making a new thread here, since most of the issues you're having would be solved easily if you only bothered to read Sony's documentation first; then again that's your call.
...Yeah, you totally understood the point of my postMihaiGamerXD wrote: ↑August 30th, 2019, 11:48 pm Ok fine, I'll stop asking for help, if you don't! This is it! I'll go myself, no one believe me I'm new!
Code: Select all
//...
#include <libcd.h>
char filebuffer[614424]; //I'll have to use this char for reading file from the CD, but still works.
CdlFILE fp;
//...
int main()
{
GsIMAGE tim;
RECT rect;
CdInit();
//...
if (CdSearchFile(&fp, "\\MY_IMAGE.TIM;1"))
{
CdReadFile("\\MY_IMAGE.TIM;1",filebuffer,0);
CdReadSync(0,0);
}
GsGetTimInfo((u_long*)(filebuffer+4),&tim);
setRECT(&rect,tim.px,tim.py,tim.pw,tim.ph);
LoadImage(&rect,tim.pixel);
setRECT(&rect,tim.cx,tim.cy,tim.cw,tim.ch);
LoadImage(&rect,tim.pixel);
DrawSync(0);
return 0;
}
Users browsing this forum: No registered users and 5 guests
Copyright © 2012-2023 PSXDEV.NET ~ No Cookies, No Tracking & No Ads. The Way the Internet Was Meant to Be ~ , "PlayStation", , , "DUALSHOCK", "Net Yaroze" and "PSone" are registered trademarks of Sony Computer Entertainment Inc. . This page is for informational use only. The user of this software, assumes full responsibility ensuring its use in accordance with local and federal laws. The software and hardware on this site is provided "as-is", without any express, implied warranty or guarantees. |