DCEmulation

dreamcast development • homebrew software • hardware hacking • indie games • emulators • and more!
Back to main site
It is currently Thu Aug 28, 2014 4:13 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 89 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next
Author Message
 Post subject:
PostPosted: Fri Apr 02, 2004 8:36 am 
Offline
DC Developer
DC Developer

Joined: Sun Dec 30, 2001 8:02 am
Posts: 9951
Quote:
are those functions and variables (vid_empty, vid_mode->fb_base, vid_mode->fb_count) in KOS 1.1.6, 1.1.7 or 1.1.8 or higher?


All based off 1.2.0, but they're in earlier versions as well.

Quote:
b) are they in the manuals or programming examples (cuz i don't remember seeing them)?


Manuals? They're really out of date, and weren't particularly good anyway.

Quote:
ok..... better yet, why is fb_size multiplied by 2 or 4 (besides the fact that it refers to two different video modes)? is fb_size in bytes, bits, or something that would make mulitplying by 2 or 4 necessary?


fb_size is in bytes. In RGB565 and RGB555 modes, each pixel takes two bytes. In RGB888 mode, each pixel takes four bytes. width * height * bytes per pixel = bytes per framebuffer.


Top
 Profile  
 
 Post subject: KOS
PostPosted: Fri Oct 15, 2004 9:30 am 
Offline
DCEmu Newbie
DCEmu Newbie

Joined: Fri Oct 15, 2004 9:26 am
Posts: 1
can someone please give me a dummies guide on how to download KOS, and how to start off.

thanks


Top
 Profile  
 
 Post subject: Re: KOS
PostPosted: Fri Oct 15, 2004 3:38 pm 
Offline
Damn Dirty Ape
Damn Dirty Ape

Joined: Thu Nov 07, 2002 10:11 pm
Posts: 5031
Location: Saugerties, NY
chrishill61 wrote:
can someone please give me a dummies guide on how to download KOS, and how to start off.

thanks

I'd use a build script.
If you're using a Linux system, you should probably have what you need for the build script to work.

If you are running Windows, then you will need a Unix environment. I use cygwin. Download their installer and run it. Select a mirror, and then you'll be presented with a list of packages. Make sure you grab the base system, all of the development tools, and wget.

Then, whether on Linux or Windows, you should be able to use a build script. (if on Windows, you'll have to start up cygwin. There should be a shortcut on your desktop.) I've used BlackAura's build script.

http://files.frashii.com/~sp00nz/Doom/f ... c_build.sh

There is also DCFreeDev. I've not used it myself, but it's another option for those on Windows. You can find it at http://www.dchomebrew.org/dcfreedev.shtml

_________________
Storm! Studios
DCHelp


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 15, 2004 3:59 pm 
Offline
Mental DCEmu
Mental DCEmu

Joined: Sun May 12, 2002 2:18 pm
Posts: 399
If you want to build latest KOS SVN versions, you'll need Jim's Makefile for linux. Will do the build for you and patch it for posix like threading.
Read ATani's posts. Worked perfectly for me ;)
http://www.dcemulation.org/phpBB/viewtopic.php?t=56352


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 15, 2004 4:13 pm 
Offline
Damn Dirty Ape
Damn Dirty Ape

Joined: Thu Nov 07, 2002 10:11 pm
Posts: 5031
Location: Saugerties, NY
bender wrote:
If you want to build latest KOS SVN versions, you'll need Jim's Makefile for linux. Will do the build for you and patch it for posix like threading.
Read ATani's posts. Worked perfectly for me ;)
http://www.dcemulation.org/phpBB/viewtopic.php?t=56352

OK... use that build script. You'll still need to make sure you've got the developer tools and wget in order for it to work, though.

<me needs to build new toolchain.>

*edit* err... does that build script download everything, or just compile it for you? I linked to BA's script because it'll download GCC, binutils, newlib, and KOS 1.2.0 for you and then compile everything.

_________________
Storm! Studios
DCHelp


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 15, 2004 6:58 pm 
Offline
DC Developer
DC Developer

Joined: Wed Oct 17, 2001 5:44 pm
Posts: 529
Location: Texas
no you have to download everything yourself, I used Jim script to build gcc 3.4.2 with posix threads under cygwin.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 01, 2005 8:44 pm 
Offline
DC Developer
DC Developer

Joined: Wed Oct 17, 2001 5:44 pm
Posts: 529
Location: Texas
BlackAura wrote:


Hey I was using your example5 and trying to edit the video.c file so it would double the graphic size

Code:
void image_draw_key_dbl(kos_img_t *image, int x, int y, uint16 key)
{
   uint16 *src, *src_start;
   uint16 *dst, *dst_start;
   int drawW, drawH;
   int startX, endX;
   int startY, endY;

   if(!image)
      return;

   /* Find the starting coordinates, and abort if off screen */
   startX = MAX(x, 0);
   if(startX >= vid_mode->width)
      return;

   startY = MAX(y, 0);
   if(startY >= vid_mode->height)
      return;

   /* Find the ending coordinates */
   endX = MIN(x + image->w, vid_mode->width);
   if(endX <= 0)
      return;

   endY = MIN(y + image->h, vid_mode->height);
   if(endY <= 0)
      return;

   /* Width, height */
   drawW = (endX - startX);
   drawH = (endY - startY)-1;

   /* Starting location for the source and destination */
   src_start = (uint16 *)image->data;
   dst_start = backbuffer_s + startX + (startY * vid_mode->width);

   /* If we're off the screen, adjust the start position */
   if(x < 0)
      src_start += -x;
   if(y < 0)
      src_start += (-y * image->w);

   /* Draw the image */
   while(drawH--)
   {
      int dw = drawW;

      /* Copy the current image source, and nudge it down one line */
      src = src_start;
      dst = dst_start;
      
      src_start += image->w;
      dst_start += vid_mode->width;

      /* Draw the line */
      while(dw--)
      {
         /* Skip transparent pixels */
         if(*src == key)
         {
            *dst++;
            *dst++;
            *src++;
         }
         else
         {
            *dst++ = *src;
            *dst++ = *src++;
         }
      }
      dw = drawW;

      /* Copy the current image source, and nudge it down one line */
      src = src_start;
      dst_start += vid_mode->width;
      dst = dst_start;

      /* Draw the line */
      while(dw--)
      {
         /* Skip transparent pixels */
         if(*src == key)
         {
            *dst++;
            *dst++;
            *src++;
         }
         else
         {
            *dst++ = *src;
            *dst++ = *src++;
         }
      }
   }
}


This is what I used, it mostly works but some graphics look like they are interlaced when it draws them, am I missing something or is this a limitation of doubling a graphic this way.

Thanks,
Troy


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 02, 2005 12:11 am 
Offline
DCEmu Ex-Mod
DCEmu Ex-Mod
User avatar

Joined: Sun Nov 04, 2001 4:12 pm
Posts: 3540
Location: Hell, Brazil
OneThirty8 wrote:
you should be able to use a build script. (...) I've used BlackAura's build script.

http://files.frashii.com/~sp00nz/Doom/f ... c_build.sh


OneThirty8 wrote:
bender wrote:
If you want to build latest KOS SVN versions, you'll need Jim's Makefile for linux. Will do the build for you and patch it for posix like threading.
Read ATani's posts. Worked perfectly for me ;)
http://www.dcemulation.org/phpBB/viewtopic.php?t=56352

OK... use that build script. You'll still need to make sure you've got the developer tools and wget in order for it to work, though.

*edit* err... does that build script download everything, or just compile it for you? I linked to BA's script because it'll download GCC, binutils, newlib, and KOS 1.2.0 for you and then compile everything.

GPF wrote:
no you have to download everything yourself, I used Jim script to build gcc 3.4.2 with posix threads under cygwin.

How can I check which versions of GCC, binutils and newlib are installed in my Linux machine, and in which directories they are? By the way, which versions of GCC, binutils and newlib are the "best" to use with KOS? And... is there anything else needed? G++ is mentioned here, but IIRC it is installed along with GCC.

I'm also a bit confused about what the word "snapshot" means. Are the downloads available at http://gamedev.allusion.net/svn/snapshots/ full versions of KOS, or are they patches/updates? And is subversion really needed?

Thanks :) .

_________________
Makaqu engine blog / website.
Image
⇈ ⇊ ⇆ ⇆ B A Start


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 02, 2005 7:54 am 
Offline
DC Developer
DC Developer

Joined: Sun Dec 30, 2001 8:02 am
Posts: 9951
GPF - You're only drawing to every other scanline.

Look at the top of the loop. Specifically, this bit:
Code:
                /* Copy the current image source, and nudge it down one line */
                src = src_start;
                dst = dst_start;
                src_start += image->w;
                dst_start += vid_mode->width;


That changes the pointers src_start and dst_start, to make them point at the start of the next line. You probably don't want to do that just yet, so it should be something like:
Code:
                src = src_start;
                dst = dst_start;
                src_start += image->w;


Then, and the start of the next iteration:
Code:
                src = src_start;
                dst = dst_start;
                src_start += image->w;
                dst_start += vid_mode->width;


The code you've got it slightly the wrong way around. You want to write the same destination line to two different source lines. The horizontal stretching appears correct though.

One other problem - you've broken the clipping code. The code is clipping the image to the edge of the screen, and then you're doubling the size of the image. You need to change the clipping code so it clips to twice the width/height. That gets a little trickier though.

Fragger - Easiest questions first...

A snapshot is a copy of KOS that's been generated from the SVN repository at a moment in time. Kinda like a photograph, hence the term "snapshot". Yes, it is a bit of a silly name, but there you go. You can just use one of those snapshots, and you won't need Subversion (unless you want the absolute latest up-to-the-minute version, or want to contribute to KOS itself).

G++ (the C++ compiler from GCC) is included with GCC. Any recent-ish DC toolchain has it.

As for where they are... That depends. Assuming you run some kind of script file (like environ.sh or something) to compile DC stuff, the path to the compilers should be in there somewhere.

Once you've found them, you can get the version of GCC and binutils like this:
Code:
/path/to/sh-elf-gcc --version
/path/to/sh-elf-as --version


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 02, 2005 10:13 pm 
Offline
DC Developer
DC Developer

Joined: Wed Oct 17, 2001 5:44 pm
Posts: 529
Location: Texas
Code:
void image_draw_key_dbl(kos_img_t *image, int x, int y, uint16 key)
{
   uint16 *src, *src_start;
   uint16 *dst, *dst_start;
   int drawW, drawH;
   int startX, endX;
   int startY, endY;

   if(!image)
      return;

   /* Find the starting coordinates, and abort if off screen */
   startX = MAX(x, 0);
   if(startX >= vid_mode->width)
      return;

   startY = MAX(y, 0);
   if(startY >= vid_mode->height)
      return;

   /* Find the ending coordinates */
   endX = MIN(x + image->w, vid_mode->width);
   if(2*endX <= 0)
      return;

   endY = MIN(y + image->h, vid_mode->height);
   if(2*endY <= 0)
      return;

   /* Width, height */
   drawW = (endX - startX);
   drawH = (endY - startY)-1;

   /* Starting location for the source and destination */
   src_start = (uint16 *)image->data;
   dst_start = backbuffer_s + startX + (startY * vid_mode->width);

   /* If we're off the screen, adjust the start position */
   if(x < 0)
      src_start += -x;
   if(y < 0)
      src_start += (-y * image->w);

   /* Draw the image */
   while(drawH--)
   {
      int dw = drawW;

      /* Copy the current image source, and nudge it down one line */
      src = src_start;
      dst = dst_start;
      
      src_start += image->w;
      dst_start += vid_mode->width;

      /* Draw the line */
      while(dw--)
      {
         /* Skip transparent pixels */
         if(*src == key)
         {
            *dst++;
            *dst++;
            *src++;
         }
         else
         {
            *dst++ = *src;
            *dst++ = *src++;
         }
      }
      dw = drawW;

      /* Copy the current image source, and nudge it down one line */
      src = src_start;
      dst = dst_start;
      dst_start += vid_mode->width;

      /* Draw the line */
      while(dw--)
      {
         /* Skip transparent pixels */
         if(*src == key)
         {
            *dst++;
            *dst++;
            *src++;
         }
         else
         {
            *dst++ = *src;
            *dst++ = *src++;
         }
      }
   }
}


Thanks BA, here is the above version that worked for what I needed. So i didn't realy test the bounding code.

Only question I have now unrelated to the above is.

If I load one image, how can I blit only part of that image? like for fonts or sprite tiles?

Thanks,
Troy


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 03, 2005 5:58 am 
Offline
DC Developer
DC Developer

Joined: Sun Dec 30, 2001 8:02 am
Posts: 9951
Quote:
If I load one image, how can I blit only part of that image? like for fonts or sprite tiles?


Err... That starts getting kinda complex.

Basically, you need to have a look at the clipping code. See how it can already draw only a part of the image? You need to do pretty much the same thing - change the start point, and the number of pixels / scanlines to copy.

Think of it this way - instead of clipping to the edge of the window, you're clipping to the coordinates you want to draw.

Just don't ask how to flip images. That's pretty hard, mostly because the clipping code becomes nightmarishly complex.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 03, 2005 9:39 am 
Offline
DCGen Creator
DCGen Creator

Joined: Fri Jan 18, 2002 11:54 pm
Posts: 66
Location: Near Yosemite, CA
BlackAura wrote:
Just don't ask how to flip images. That's pretty hard, mostly because the clipping code becomes nightmarishly complex.


How is flipping complex? You basically modify the logic for moving between lines (depending on flip orientation) and the starting point for source/dest.

Its rather simple actually..

Mike


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 03, 2005 11:45 am 
Offline
Mental DCEmu
Mental DCEmu

Joined: Thu Oct 10, 2002 5:18 pm
Posts: 415
a litte explanation please? :mrgreen:


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 03, 2005 4:20 pm 
Offline
DC Developer
DC Developer

Joined: Wed Oct 17, 2001 5:44 pm
Posts: 529
Location: Texas
Quote:
Basically, you need to have a look at the clipping code. See how it can already draw only a part of the image? You need to do pretty much the same thing - change the start point, and the number of pixels / scanlines to copy.

Think of it this way - instead of clipping to the edge of the window, you're clipping to the coordinates you want to draw.


Thanks that was just what I needed to figure this out .

Troy


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 04, 2005 3:01 am 
Offline
DC Developer
DC Developer

Joined: Sun Dec 30, 2001 8:02 am
Posts: 9951
Quote:
How is flipping complex? You basically modify the logic for moving between lines (depending on flip orientation) and the starting point for source/dest.


Simply because the code for clipping the image to the edge of the screen becomes... somewhat difficult to explain. It's not actually difficult, but you end up with a bit of code about three times the length of the non-clipping variety, or even longer if you have the partial-drawing code in there as well, with a huge number of almost incomprehensible if's and calculations. Basically, it's just me being too lazy to explain exactly how to do it. And I couldn't get it to work properly...

Actually drawing a flipped image is a piece of cake, of course.

GPF - One other thing... Why do you want to draw part of an image? There's very little point in storing all your images inside one larger image, unless you have some kind of limitation on the image sizes (say, you're using 3D hardware an can only use power-of-two textures) and your images can be packed into a large image more efficiently. In this case, simply storing separate images wouldn't use much (if any) more memory.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 04, 2005 7:27 am 
Offline
Iron Fist of Justice
Iron Fist of Justice
User avatar

Joined: Sat Nov 10, 2001 2:08 am
Posts: 4931
Location: Houma
How about you draw the screen normally to an intermediate texture, then draw that one flipped.

_________________
No signature.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 05, 2005 2:58 pm 
Offline
DC Developer
DC Developer

Joined: Wed Oct 17, 2001 5:44 pm
Posts: 529
Location: Texas
Quote:
GPF - One other thing... Why do you want to draw part of an image? There's very little point in storing all your images inside one larger image, unless you have some kind of limitation on the image sizes (say, you're using 3D hardware an can only use power-of-two textures) and your images can be packed into a large image more efficiently. In this case, simply storing separate images wouldn't use much (if any) more memory.


Cool, didn't realize that. I working on moving away from SDL because of its horrendous memory leaks, so im just accustomed to using tiled graphics. I found a cool little utility to split graphics up so im just loading them all in an array then I use your video code to draw everything as needed.

Troy


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 08, 2005 2:14 am 
Offline
DCEmu Ex-Mod
DCEmu Ex-Mod
User avatar

Joined: Sun Nov 04, 2001 4:12 pm
Posts: 3540
Location: Hell, Brazil
I have downloaded Jim Ursetto's dc-chain-0.1, gcc-3.4.1, newlib-1.12.0, binutils-2.15, and kos-snapshot-20050101. Then I removed the KOS patches (which are unnecessary in the last versions of KOS), and typed "make" without parameters in the KDE's root console (I figured it could be necessary to do this since normal users can't write files in the /usr/local dir). Everything went fine, and now I have the dirs /usr/local/dc/arm-elf and /usr/local/dc/sh-elf with some files and subdirs inside.

Now it seems that I have to edit the environ.sh file and compile KOS. Apparently what the environ.sh file does is to set the environment variables (paths, and maybe other stuff). My problem is, I got stuck in a line containing a reference to "/usr/local/dc/bin", because I don't have this directory; I only have /usr/local/dc/arm-elf and /usr/local/dc/sh-elf. Will this dir be created when I compile KOS, or should I do something else before?

I probably have no clue about what I'm doing...


BlackAura wrote:
As for where they are... That depends. Assuming you run some kind of script file (like environ.sh or something) to compile DC stuff, the path to the compilers should be in there somewhere.

Once you've found them, you can get the version of GCC and binutils like this:
Code:
/path/to/sh-elf-gcc --version
/path/to/sh-elf-as --version

There's something weird happening here. I open the console, go to /usr/local/dc/sh-elf/bin, and when I enter "sh-elf-gcc --version" or just "sh-elf-gcc" I get a message saying that it doesn't exist. However, the file is there. The "dir" command shows it, as well as the Konqueror's file manager. And I've tried it as a normal user, as well as a root user.

_________________
Makaqu engine blog / website.
Image
⇈ ⇊ ⇆ ⇆ B A Start


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 08, 2005 2:51 am 
Offline
DC Developer
DC Developer

Joined: Sun Dec 30, 2001 8:02 am
Posts: 9951
Quote:
There's something weird happening here. I open the console, go to /usr/local/dc/sh-elf/bin, and when I enter "sh-elf-gcc --version" or just "sh-elf-gcc" I get a message saying that it doesn't exist.


That's an easy one - Linux is not DOS.

In DOS, when you type the name of a command, the command interpreter checks if you've given it a full path (like C:\Stuff\OtherStuff\File.exe), and if you have it tries to run that. If it's not a full path, it will first search in the current directory, and then search all the directories in the PATH environment variable until it finds a match. It does this mostly because DOS was originally intended to run off floppy disks, so the path was mostly meaningless...

In Linux (and other Unix-like systems), when you type the name of a command, the shell checks if you've given it a full path (like /usr/local/dc/sh-elf/bin/sh-elf-gcc) and if you have it tries to run that. If it's not a full path, it searches all the directories in the PATH environment variable until it finds a match.

Notice the difference - Linux shells do not run programs from the current directory. That's mostly a security measure, to prevent a user from accidentally running a program that's in the current directory. For example, you could put a fake version of the "ls" command in your home directory, and as soon as someone tries to list the contents of your home drive (most likely the root user, since nobody else can even get into your home directory), your program could do massive damage. Like wipe out the entire system.

So, if you want to run a program from inside the current directory, do this:
Code:
./programname


The ./ tells the shell that the program is in the current directory. Alternatively, just give the whole path to the program.

Quote:
My problem is, I got stuck in a line containing a reference to "/usr/local/dc/bin", because I don't have this directory; I only have /usr/local/dc/arm-elf and /usr/local/dc/sh-elf. Will this dir be created when I compile KOS, or should I do something else before?


What kind of line is it? If it's something like:
Code:
PATH=$PATH:/usr/local/dc/bin
then you should change it to something like this:
Code:
PATH=$PATH:/usr/local/dc/sh-elf/bin:/usr/local/dc/arm-elf/bin
.

For almost anything else (like KOS_CC_BASE, or something), they you need to change it to either sh-elf/bin or arm-elf/bin, depending on which compiler it's referencing.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 08, 2005 8:00 pm 
Offline
DCEmu Ex-Mod
DCEmu Ex-Mod
User avatar

Joined: Sun Nov 04, 2001 4:12 pm
Posts: 3540
Location: Hell, Brazil
BlackAura wrote:
That's an easy one - Linux is not DOS.
:lol:

BlackAura wrote:
What kind of line is it? If it's something like:
Code:
PATH=$PATH:/usr/local/dc/bin
then you should change it to something like this:
Code:
PATH=$PATH:/usr/local/dc/sh-elf/bin:/usr/local/dc/arm-elf/bin


For almost anything else (like KOS_CC_BASE, or something), they you need to change it to either sh-elf/bin or arm-elf/bin, depending on which compiler it's referencing.

It's this line:
Code:
# Expand PATH (comment out if you don't want this done here)
export PATH="${PATH}:${KOS_CC_BASE}/bin:/usr/local/dc/bin"


I changed it to:
Code:
# Expand PATH (comment out if you don't want this done here)
export PATH="${PATH}:${KOS_CC_BASE}/bin:${DC_ARM_BASE}/bin"
#/usr/local/dc/bin"

I got it working now, thank you very much BA :D.

_________________
Makaqu engine blog / website.
Image
⇈ ⇊ ⇆ ⇆ B A Start


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 89 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group