Jump to content

Recommended Posts

Posted

Hey mic,

 

could you check if BytesPerCluster is in Synch with SectorPerCluster?

 

That's the only difference i can see atm that fseek (which is still not working correct here) with the in fread() included seek to next sector differs.

  • Replies 22
  • Created
  • Last Reply

Top Posters In This Topic

Posted

Do you mean filesysBytePerClus ? It's calculated in chishm's library as filesysBytePerSec * filesysSecPerClus, where filesysBytePerSec is hardcoded as 512 (same sector size I use in dualis) and filesysSecPerClus is taken from the master boot record (this is set to 16 in dualis).

Posted
Do you mean filesysBytePerClus ? It's calculated in chishm's library as filesysBytePerSec * filesysSecPerClus, where filesysBytePerSec is hardcoded as 512 (same sector size I use in dualis) and filesysSecPerClus is taken from the master boot record (this is set to 16 in dualis).

 

 

hmm, yeah you'r right... darn that bastard has to hide somewhere...

Posted

You could try modifying fseek to print out the values of certain variables at strategic places and compare them to what you'd expect them to be.

  • 2 weeks later...
Posted
You could try modifying fseek to print out the values of certain variables at strategic places and compare them to what you'd expect them to be.

 

The latest release seems to have the seek problem fixed. Looks like it was the faulty div.

  • 2 weeks later...
  • 2 weeks later...
Posted (edited)

i dont know if anyone is experiencing this, but when I FAT_fopen(..."r") then close it, then FAT_fopen(..."w") dualis seems to crash when i want to write to the file

 

on the DS, i believe that it just freezes on the DS, but that may just be because its having the issues with the writing to begin with,

 

just something that should be looked into perhaps ??? thanks for ur time

 

 

fixed ds bug, seems like an emu issue

 

what the code looks like....

#include <nds.h>
#include "../../general/command.h"
#include <nds/arm9/console.h> //basic print funcionality
#include <stdio.h>
#include <stdlib.h>
#include <gbfs.h>    // filesystem functions
#include "gba_nds_fat/gba_nds_fat.h"
FAT_FILE *fps;
int main(void)
{
//irqs are nice
 

 lcdMainOnBottom();

 FAT_InitFiles();
 
 fps = FAT_fopen("a.txt","r");
 FAT_fclose(fps);
 fps = FAT_fopen("a.txt","w");
 int wasWritten = FAT_fwrite("0",1, 1, fps); 
 FAT_fclose(fps);
}

Edited by knight0fdragon
Posted (edited)

I got another error with Chishm's Fat driver on dualis.

 

(Its related to the crash i told you on IRC, mic)

 

I added a log-write to what bitmaps i am reading, and the result was not what i expected on dualis. (I added HW and dualis results at the end)

 

// all images
LPORDEREDLIST bitmaps = 0;

void LoadImages(void) 
{

#define LOGME
FAT_FILE *lst = FAT_fopen("bmp.lst","r");
#ifdef LOGME
FAT_FILE *log = FAT_fopen("bmp.log","w+");
#endif
if (lst==0) return;

bitmaps = new ORDEREDLIST();

char *line = new char[100];
while (!FAT_feof(lst)) {
 FAT_fgets(&line[0],100,lst);
#ifdef LOGME
 FAT_fputs("Read line:",log);
 FAT_fputs(line,log);
 FAT_fputs("\n",log);
#endif  
 int id,flag,r,g,b;
 char bmpname[100];
 if ((line[0]>32) && (line[0]!='#')) {
	 sscanf(&line[0],"%d %s %d %d %d %d",&id,&bmpname[0],&flag,&r,&g,&b);
	 LPBITMAP tmp = new BITMAP(bmpname);
	 if (flag & 1) tmp->ApplyKeycolor(RGB15(r >> 3,g >> 3,b >> 3));
	 bitmaps->AddEntry(id,tmp);
#ifdef LOGME
	 FAT_fputs("Bitmap load\n",log);
 } else {
	 FAT_fputs("It's a comment\n",log);
#endif
 };
};
delete line;
FAT_fclose(lst);
FAT_fclose(log);
};

 

That results in this log.txt on dualis: http://mightymax.org/Dualis_BMP.log

and on hardware: http://mightymax.org/HW_BMP.log

 

The original bmp.lst file both tests used is http://mightymax.org/bmp.lst

Edited by Mighty Max
Posted

As you mentioned on IRC that you can't tell if it isn't some sideeffekt through the interlacing read&writes etc...

 

i updated my sources to read the whole.lst in one buffer and manually go through the lines. That works just fine on Dualis.

 

:banghead:

 

Proof:

All images loaded ;)

dualis01.png

  • 3 weeks later...
Posted

*bump* Another problem I'm having with Dualis - using the latest version of Chism's code, the GetFileSize() function appears to return 0 when I use it under Dualis? FileOpen/Read etc. is all OK, just GetFileSize is wrong.

 

Anybody else had this problem? Any known workarounds?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...