Results 1 to 9 of 9

Thread: question about KOS

                  
   
  1. #1
    DCEmu Newbie
    Join Date
    Oct 2004
    Location
    Posts
    11
    Rep Power
    0

    Default question about KOS

    i have 2 questions about KOS


    1. is it possible to load graphic in the main ram
    and from there in the video ram



    2. how does the threads working?
    is there any samle code?

    my problem is that i want to load from the disc during the game
    so i thought i make 2 threads
    1 thread is the normal game engine with high priority
    1 thread is for loading gfx with low priority that is working if time is left in a frame.

    the game is running with 60 fps. if the game engine has to much to do
    somtimes it changes to 30 fps, thats ok,
    but loading gfx should not be change the framerate.


    is it generaly possible to change a thread during loading a gfx?


  2. #2
    DCEmu Newbie
    Join Date
    Oct 2004
    Location
    Posts
    11
    Rep Power
    0

    Default Re: question about KOS

    can no one help how to load
    gfx from disc to main ram
    and from main ram to video ram?

    i only know how to load from CD direct to video ram.

  3. #3
    DCEmu Coder
    Join Date
    Apr 2004
    Posts
    227
    Rep Power
    57

    Default Re: question about KOS

    You can only load graphics to VRAM if you're using the 3D rendering hardware, and how you do it depends on what you're loading, and how you want to use it.

  4. #4
    DCEmu Newbie
    Join Date
    Oct 2004
    Location
    Posts
    11
    Rep Power
    0

    Default Re: question about KOS

    what do you mean if i using 3D rendering?

    i want to load the texture (pcx and png) files
    into main ram.

    for what does i have 16 MB ram if i cant use it

    what is in the main ram
    16 MB is a little bit big for ony the programm

  5. #5
    DCEmu Coder
    Join Date
    Apr 2004
    Posts
    227
    Rep Power
    57

    Default Re: question about KOS

    Main memory gets eaten up really quickly if you're storing complex 3D models or levels. Some commercial games also use it to store textures and sound effects which are used in the current level, but aren't needed yet.

    I assume you want to do something similar - load new graphics while the game is going, so you don't have to stop and load them later, right?

    The easiest way is to copy them into the KOS ramdisk. Basically, you copy your files from /cd to /ram, and then load them from there the same way you would load them from CD. And the easiest way to copy files is:
    Code:
    fs_copy("/cd/filename.png", "/ram/filename.png");
    Make sure you delete them when you've loaded them, because you'll run out of main RAM pretty quickly if you don't:
    Code:
    fs_unlink("/ram/filename.png");
    One other thing you might consider - use the KMG image format instead of PNG or PCX.

    When KallistiOS copies a PNG (or PCX) over to main memory, it needs to first convert it to a format the Dreamcast's video hardware can deal with. The PNG loader also doesn't realise that the file is already in memory. So, it loads the PNG, then decompresses it (allocating more memory), then converts it (taking up more memory still), and then copies it over. That's fine if you're loading them one at a time, but if you have lots of then stored in memory at once, you might run out of space.

    A KMG is already converted, and the KMG loader can deal with the ramdisk (and romdisk) correctly. So, when you're loading a KMG from the ramdisk, it just copies the data over immediately.

    As for the threading... It should work, as long as your loader thread isn't doing anything except loading. That means no compression or anything - just reading directly off the disc, and putting it into main memory.

    If you're using a new-ish version of KallistiOS, you can also use romdisks instead of the ramdisk. Basically, you can pack all of the data you need for each level into a romdisk, and get the game to load that. You can then attach the romdisk somewhere (say, /data) and read files from there. This is what Feet of Fury does. In your loader thread, you can do something like this:
    Code:
    ssize_t size;
    void *data;
    size = fs_load("/cd/datafile.rd", &data);
    assert(size != -1);
    fs_romdisk_mount("data", data, 1);
    Now, all the files in the romdisk will be available from /data. When you're done with them, you can remove the romdisk image from memory like this:
    Code:
    fs_romdisk_umount("data");

  6. #6
    DCEmu Newbie
    Join Date
    Oct 2004
    Location
    Posts
    11
    Rep Power
    0

    Default Re: question about KOS

    how can i covert my image to KMG?
    gimp or adope dont support this format

  7. #7
    DCEmu Coder GPF's Avatar
    Join Date
    Apr 2004
    Location
    Texas
    Age
    47
    Posts
    796
    Rep Power
    61

    Default Re: question about KOS

    under the KOS utilities folder is a program called kmgenc , which is a command line utility to convert to kmg format.

  8. #8
    DCEmu Newbie
    Join Date
    Oct 2004
    Location
    Posts
    11
    Rep Power
    0

    Default Re: question about KOS

    from what format can i convert?

    i convertet from png to kmg
    and the compiler says:inverted, non-twiddled loading not supported yet.


    kmgenc with no options what color format does it transform?
    565?

    why does the -a1 not work (only -a4)

    if i make graphic with transparent where can i know if it is 4444 or 1555

    and what is the different between rgb_565 and rgb_565_TWID

  9. #9
    DCEmu Coder GPF's Avatar
    Join Date
    Apr 2004
    Location
    Texas
    Age
    47
    Posts
    796
    Rep Power
    61

    Default Re: question about KOS

    I haven't used it yet, sorry

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •