Sega Saturn Development > General Jo Engine Help

Usage of GFS_NwFread (you probably expected this...)

<< < (2/6) > >>

ponut64:
You know the way I was doing isn't technically how I wanted to do it anyway. I want to use the CD Buffer, and for that I need to first use NwCdRead then fetch from CD buffer into the work area.
I guess that's one way to potentially use the CD buffer as some sort of RAM.

XL2:
I'm getting close to have animation support.
The new version and code should be out in a few days if all goes well (I could encounter deal breaking bugs as I know very little about animation).
DAE would have made my life way easier if I just focused on that format a while ago, but now I won't have time for it, so let's hope everything works OK!

ponut64:
My man, I'm sure I speak for a lot of folks who may not even post here. I really appreciate what you do, and what Jo has done for all of us wanting to make games for the Saturn.
Binary model files of any kind was a huge step toward creating a fully fledged 3D game for the Saturn.. rather modularly
I hadn't any time to work on what I was doing today either, but at least I can write code that compiles

ponut64:
Thinking out here again. I'm debugging things a little more closely. I've come to this.

It reads the correct amount of data to the CD buffer.
It completes and does not crash.
memcpy successfully copies the CD buffer data to the struct buffer from ptr.
The data copied is correct.
After setting the entity_t data from the modelData_t buffer using your commands, the data is correct.
But after it finishes loading binaries, it is gone. The mesh does not have any data, whether or not I load something else.

I am missing something very simple... something that if I understood it, I could probably use jo engine async reading system.


--- Quote ---//Experimental
void * ztFileStream(Sint8 * filename, void * startAddress, entity_t * model, Sint8 dummy)
{
   
    memset_l((void*)startAddress,0x0000, (0xFFFE - ((Uint32)startAddress-(Uint32)LWRAM)));  //Not 100% necessary, since data can just be overwritten, but good for testing and see how much data a level takes
    void * currentAddress;
    currentAddress = startAddress;
//Data of read structure
    Sint32 fid = GFS_NameToId((Sint8*)filename);
   GfsHn gfs;
   Sint32 nsct;
   Sint32 fsize;
//Data of read-in-process
   Sint32 stat;
   Sint32 rdsize;
//Model Data is the destination of data in the work area.
   modelData_t bufModel;
//Destination address?
    void * ptr = &bufModel;
//Loading follows
   gfs = GFS_Open(fid);
//Get sectors
   GFS_GetFileSize(gfs, &nsct, NULL, NULL);
   GFS_GetFileInfo(gfs, NULL, NULL, &fsize, NULL);
   
jo_printf(0, 18, "(%i)", nsct);
jo_printf(0, 20, "(%i)", fsize);
jo_printf(0, 22, "(%i)", proc_bp);

   
//Read from CD to CD buffer

   GFS_NwCdRead(gfs, fsize);
   GFS_SetTransPara(gfs, nsct);
   GFS_NwFread(gfs, nsct, (Uint32*)currentAddress, fsize);
   do{
      GFS_NwExecOne(gfs);
      GFS_NwGetStat(gfs, &stat, &rdsize);
jo_printf(0, 24, "(%i)", rdsize);
   }while (stat != GFS_SVR_COMPLETED && rdsize < fsize);
   
   GFS_Close(gfs);
   
   /**Copy gfs to modelData_t bufmodel???**/
   memcpy_l((Sint32*)ptr, (Sint32*)(currentAddress), sizeof(modelData_t));
   
    /**ADDED**/
    model->pos[X]=bufModel.Origin[X]; model->pos[Y]=bufModel.Origin[Y]; model->pos[Z]=bufModel.Origin[Z];
    model->length[X]=bufModel.Length[X]; model->length[Y]=bufModel.Length[Y]; model->length[Z]=bufModel.Length[Z];
    model->nbMeshes=bufModel.TOTAL_MESH;
   
    Uint16 first_texture = loadTextures(startAddress, &bufModel);
    Sint32 bytesOff = bufModel.TEXT_SIZE+(sizeof(modelData_t)) - (bytesOff*2048);
   currentAddress = (void*)(currentAddress + bytesOff);
   currentAddress = loadPDATA((void*)(currentAddress), model, &bufModel);
   currentAddress = startAddress;
    setTextures(first_texture, model, bufModel.TOTAL_MESH, true);
   
   jo_printf(0, 14, "(%i)", bufModel.TOTAL_MESH);
   jo_printf(0, 16, "(%i)", bufModel.PDATA_SIZE);
   jo_printf(0, 10, "(%i)", model->nbMeshes);
   
          return currentAddress;
   
}
--- End quote ---

XL2:
My functions overwrite the texture data after transfering to VRAM, so it doesn't work because you don't update the currentaddress correctly.
Look at your byte offset : you initialize it by calling itself, which doesn't work.
That offset is for cd sectors, which doesn't work here since all the data is dumped in RAM.
Your current adress should be : sizeof (mod data) + Texture size.
But it's bad practice because you don't need the textures in work RAM.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Sitemap 1 2 3 4 5 6 7 8 9 10 
Go to full version