DCEmulation

dreamcast development • homebrew software • hardware hacking • indie games • emulators • and more!
Back to main site
It is currently Sun Sep 24, 2017 11:20 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 81 posts ]  Go to page 1, 2, 3, 4, 5  Next
Author Message
 Post subject: Wiki feedback
PostPosted: Tue Mar 15, 2016 7:19 am 
Offline
Moderator
Moderator
User avatar

Joined: Sun Apr 20, 2014 7:45 am
Posts: 567
Hello,

I have some free time on my hands and thought it would be a good idea to convert some forum posts to wiki entries to avoid redundant questions and make it easier for people to get into DC development.
So if there's anything you would like a tutorial on, please ask for it here and we can figure out who is capable of writing a wiki entry for it.
If you want to help, you can hunt for old tutorials on the forums and link them here, so we can update and convert them to a wiki entry.
I will add your suggestions to this list.

Link to the wiki page with tutorials: http://dcemulation.org/?title=Development

Wiki entries to write:
  • IRC channel (bogglez, old page)

Setup
  • Compiling KOS on Windows (bogglez) (some issues on Windows, need help)
  • Compiling KOS on OS X
  • Compiling KOS on Linux (bogglez)

General
  • About the CPU (store queues, DMA) (bogglez, old tutorial) (stub)
  • Memory map (bogglez, from Marcus Comstedt's website)
  • How to obtain controller inputs
  • How to read data (romdisk, cd, vmu) (bogglez, tutorial by emptythought from '08) (only VMU part, needs verification)
  • Video: Hardware Architecture Breakdown (https://www.youtube.com/watch?v=1_XhD5Msurc by Nexus Externi)
  • Romdisk Swapping (by Lerabot)

Graphics
  • About the DC graphics hardware
  • PVR API vs OpenGL vs software rendering (bogglez, need feedback)
  • About PVR texture formats and compression (bogglez, need feedback)
  • Rendering geometry efficiently

    PVR
  • 2D rendering without using the PVR graphics chip (bogglez, old page, tutorial by BlackAura) (check whether up-to-date)
  • How to load and display paletted textures (bogglez, tutorial by BlackAura) (check correctness)
  • Creating and loading KMG textures (bogglez) (need feedback)
  • Spritesheet animation with PVR (bogglez) (need feedback)
    OpenGL
  • Loading PNG images as OpenGL textures

Sound and Music
  • About the DC sound hardware
  • How to play sounds
  • How to stream music

Deployment
  • About IP.bin 1st.bin and scrambling
  • Burning a game to disc
  • Transfer over serial, modem or BBA

VMU and other accessories
  • Writing programs for the VMU
  • Making the VMU beep
  • Rumble

FAQs
  • Porting FAQs (bogglez, Schnapple's and DirtySanchez's FAQ from '02) (needs up-to-date check)

_________________
Wiki & tutorials: http://dcemulation.org/?title=Development
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream


Last edited by bogglez on Thu Sep 15, 2016 10:56 am, edited 33 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Wiki feedback
PostPosted: Tue Mar 15, 2016 7:57 am 
Offline
DCEmu Junior
DCEmu Junior

Joined: Thu Mar 10, 2016 6:14 am
Posts: 41
I agree with that. As I'm new, I will certainly ask the same questions again, but I make some search before on forum :mrgreen:

I think Compiling KOS on Windows will be great for other newcomers.
The biggest problems for me are video memory occupation and drawing texture with 16,8,4-bit. And Threading to load data while playing.

I finally find a tuto about the texture loading but I can not get it to work.
viewtopic.php?f=29&t=99166


Top
 Profile  
Reply with quote  
 Post subject: Re: Wiki feedback
PostPosted: Tue Mar 15, 2016 8:26 am 
Offline
Moderator
Moderator
User avatar

Joined: Sun Apr 20, 2014 7:45 am
Posts: 567
Could somebody please write the "Transfer over serial, modem or BBA" tutorial? I don't use that method.

http://dcemulation.org/index.php?title= ... _Dreamcast

This is the old tutorial (it's pretty much useless I assume).
Spoiler: show
==dcload==

'''NOTE: This section is still incomplete!

The dcload package is a pair of programs, dc-tool and dcload, that allow you to upload and run your programs on the Dreamcast. dcload is burned onto a CDROM and run on the Dreamcast. After it starts, it waits for dc-tool on the PC to communicate and upload data.

Two versions of the dcload package exist: dcload-ip, which works over an ethernet connection (BBA, Lan adapter), and dcload-serial, which works over a serial port connection (Coders cable, USB cables).

I will only cover dcload-serial here. The process for dcload-ip should be similar though.

First we download the latest version from the subversion repository:

$ svn co https://cadcdev.svn.sourceforge.net/svn ... oad-serial

Next we have to edit Makefile.cfg. Three settings are important here:

HOSTCC sets the compiler that should be used to create the tool that will run on your PC. Again we have to use GCC <= 3.4.

HOSTCC = gcc-3.4

TARGETPREFIX tells the compiler where to find the toolchain.

TARGETPREFIX = /home/foobert/dc/sh-elf

Finally, TOOLINSTALLDIR tells make where to install the tools.

TOOLINSTALLDIR = /home/foobert/dc/bin

Now we can compile and install:
$ make
$ make install

dc-tool should now be available in /home/foobert/dc/bin.

In target-src/1st_read, you will find the binary that is to be burned onto CDROM and booted on the Dreamcast.

For now I will not cover how to burn the CDROM. The Makefile in make-cd did not work for me the last time I tried it, so I ended up doing it manually. You also need the scramble utility for the process to work.

Check the net and the usual Dreamcast communities for info on how to burn bootable CDROMS.

I might add this info in a later revision of this tutorial.


And dc-load
Spoiler: show
DC-LOAD is the server program meant to be run on the Sega Dreamcast. DC-Load is part of the set of DC-Tool / DC-Load combination. See the DC-Tool for more information on running this setup. To be used, you must have a way to connect your Dreamcast console to your computer, it can be one of the following:

A Coders Cable (a serial cable, the historical way to do that)
A Broadband Adapter, often shortened as “BBA” (a 10/100Mbits network Ethernet card).
This program, originally developed by ADK/Napalm and now full part of the KallistiOS library (used in the homebrew developments targeted to the Sega Dreamcast) is split in two packages:

DC-LOAD, the server part, started from the Dreamcast
DC-TOOL, the client part, started from the computer (can be GNU/Linux or Windows).
Depending on the method chosen (Coders Cable or BBA) you must use the right version of the program:

DC-LOAD or DC-LOAD-SERIAL for the Coders Cable version
DC-LOAD-IP for the BBA version



I converted Ph3nom's cygwin tutorial but I don't know whether it works (especially since it uses 2.0 + some patches instead of git), so feedback would be appreciated:
http://dcemulation.org/?title=Compiling_KOS_on_Windows


I had a look at the PVR document, and think it should be rewritten. It explains a poor way of geometry submission that should not be used (pvr_prim). People who want an easy way to do graphics should use OpenGL anyway.
I think the PVR article should explain concepts like display lists (in more detail), modifier volumes, the command queue, polygon contexts, fixed pipeline functionality (culling etc) and proper geometry submission (store queue or dma).


Regarding the filesystem:
I found this mount tutorial by BlackAura, but I'm unsure whether I should include it.. does anybody use romdisks as files? It's also a bit lacking in info about the general filesystem and VMU info..
viewtopic.php?f=29&t=68795#p744100


VMU Beep: viewtopic.php?f=29&t=97048


Haven't finished sifting through this entirely yet: viewtopic.php?f=29&t=100002


And with that I'm done for today and will wait for some reactions. :-)

_________________
Wiki & tutorials: http://dcemulation.org/?title=Development
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream


Top
 Profile  
Reply with quote  
 Post subject: Re: Wiki feedback
PostPosted: Wed Mar 16, 2016 8:58 am 
Offline
Moderator
Moderator
User avatar

Joined: Sun Apr 20, 2014 7:45 am
Posts: 567
I've added the tutorial "Creating and loading KMG textures" to graphics http://dcemulation.org/?title=KMG_Textures

_________________
Wiki & tutorials: http://dcemulation.org/?title=Development
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream


Top
 Profile  
Reply with quote  
 Post subject: Re: Wiki feedback
PostPosted: Sun Mar 20, 2016 3:52 pm 
Offline
Moderator
Moderator
User avatar

Joined: Sun Apr 20, 2014 7:45 am
Posts: 567
tonma wrote:
The biggest problems for me are video memory occupation and drawing texture with 16,8,4-bit. And Threading to load data while playing.

I finally find a tuto about the texture loading but I can not get it to work.
viewtopic.php?f=29&t=99166

I've added a tutorial for PVR spritesheet animation: http://dcemulation.org/?title=PVR_Spritesheets

I hope it answers some of your questions.

_________________
Wiki & tutorials: http://dcemulation.org/?title=Development
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream


Top
 Profile  
Reply with quote  
 Post subject: Re: Wiki feedback
PostPosted: Sun Apr 03, 2016 8:58 am 
Offline
Moderator
Moderator
User avatar

Joined: Sun Apr 20, 2014 7:45 am
Posts: 567
The Memory Map article was very minimalistic, so I've copied the article from Marcus Comstedt's website with his permission: http://dcemulation.org/?title=Dreamcast_Memory_Map

_________________
Wiki & tutorials: http://dcemulation.org/?title=Development
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream


Top
 Profile  
Reply with quote  
 Post subject: Re: Wiki feedback
PostPosted: Mon Apr 04, 2016 5:02 pm 
Offline
DC Developer
DC Developer

Joined: Tue Feb 11, 2003 3:12 pm
Posts: 935
Location: In a Dream
It's nice to know that a pioneer such as Marcus Comstedt is still reachable. Good Work btw.

_________________
behold the mind
inspired by Dreamcast


Top
 Profile  
Reply with quote  
 Post subject: Re: Wiki feedback
PostPosted: Mon Apr 04, 2016 6:07 pm 
Offline
DCEmu Webmaster
DCEmu Webmaster
User avatar

Joined: Wed Mar 14, 2001 5:00 pm
Posts: 16050
Location: New Orleans, LA
It actually hasn't been that long since he's been active in the DC scene. The most recent version of dc-virtcd was released about 4 years ago.

_________________
It's thinking...


Top
 Profile  
Reply with quote  
 Post subject: Re: Wiki feedback
PostPosted: Tue Apr 05, 2016 9:12 pm 
Offline
DC Developer
DC Developer

Joined: Tue Feb 11, 2003 3:12 pm
Posts: 935
Location: In a Dream
From the very beginning I have been the desire to make some kind of Dreamcast history movie and this wiki would be useful.

Ours is quite the epic tale with plenty of drama with lots of interesting personalities, conflicts...

_________________
behold the mind
inspired by Dreamcast


Top
 Profile  
Reply with quote  
 Post subject: Re: Wiki feedback
PostPosted: Tue Apr 19, 2016 6:33 am 
Offline
DCEmu Junior
DCEmu Junior

Joined: Thu Mar 10, 2016 6:14 am
Posts: 41
Hi,

I have some questions about the code / tutorial " PVR spritesheet animation".

In this part :
Code:
/* Draw animated enemies */
   uint8_t sprite_number = (unsigned)(0.01f * timer_ms_gettime64()) % 8;
   char sprite_name[32];
   snprintf(sprite_name, sizeof(sprite_name), "mage_combat%u", sprite_number);
   sprite_name[31] = 0;
   draw_sprite(&stage1_actors_sheet, sprite_name, 100, 300, stage1_actors_palette_number);

   snprintf(sprite_name, sizeof(sprite_name), "mage_shadowform%u", sprite_number);
   sprite_name[31] = 0;
   draw_sprite(&stage1_actors_sheet, sprite_name, 250, 300, stage1_actors_palette_number);

   snprintf(sprite_name, sizeof(sprite_name), "mage_idle%u", sprite_number);
   sprite_name[31] = 0;
   draw_sprite(&stage1_actors_sheet, sprite_name, 350, 300, stage1_actors_palette_number);


Why do you use "sprite_name[31] = 0;" And always the value 31 ? I understand sprite_name is the char array of the sprite_name but after :oops:


And I wish to use PAL4BPP image to load more images :
I change the setup_palette to load th good palette number and in the draw_sprite function, I change :
Code:
pvr_poly_cxt_txr(&context, PVR_LIST_PT_POLY, PVR_TXRFMT_PAL4BPP | PVR_TXRFMT_4BPP_PAL(palette_number), sheet->width, sheet->height, sheet->texture, PVR_FILTER_NONE);


The emulator crash when it comes to the spritesheet_load function at :
Code:
/* Only allow 8 bit palette dtex files */
   if(memcmp(dtex_header.magic, "DTEX", 4) || dtex_header.type != 0x30000000) {
      result = 3;
      goto cleanup;
   }


How can I allow 4 bit pallette ?


Top
 Profile  
Reply with quote  
 Post subject: Re: Wiki feedback
PostPosted: Tue Apr 19, 2016 8:23 am 
Offline
Moderator
Moderator
User avatar

Joined: Sun Apr 20, 2014 7:45 am
Posts: 567
tonma wrote:
Hi,

I have some questions about the code / tutorial " PVR spritesheet animation".

In this part :
Code:
/* Draw animated enemies */
   uint8_t sprite_number = (unsigned)(0.01f * timer_ms_gettime64()) % 8;
   char sprite_name[32];
   snprintf(sprite_name, sizeof(sprite_name), "mage_combat%u", sprite_number);
   sprite_name[31] = 0;
   draw_sprite(&stage1_actors_sheet, sprite_name, 100, 300, stage1_actors_palette_number);

   snprintf(sprite_name, sizeof(sprite_name), "mage_shadowform%u", sprite_number);
   sprite_name[31] = 0;
   draw_sprite(&stage1_actors_sheet, sprite_name, 250, 300, stage1_actors_palette_number);

   snprintf(sprite_name, sizeof(sprite_name), "mage_idle%u", sprite_number);
   sprite_name[31] = 0;
   draw_sprite(&stage1_actors_sheet, sprite_name, 350, 300, stage1_actors_palette_number);


Why do you use "sprite_name[31] = 0;" And always the value 31 ? I understand sprite_name is the char array of the sprite_name but after :oops:

This is a problem with C's snprintf. When you write char * string = "foo"; in C, it's basically a shortcut for char string[] = {'f', 'o', 'o', 0}.
String functions will then use the 0 to detect the end of the string.
sprite_name is defined as an array of 32 chars, their indices are 0..31 (you need to count index 0 as well, so indices 1..31 = 31 chars, plus index 0 = 32).
snprintf will copy one string to another, it will then add a 0 to the end. However, it will not do that if there is not enough space.
If it copies a full 32 characters and you do something like puts(sprite_name);, the function will not know where the end of the string is and it will read memory past the end, which will cause all kinds of problems.
That's why I just said "the last character must be 0". Basically I'm cutting the string off if it is too long.
A more solid way would be to detect that the string generated by snprintf is too long for its destination sprite_name and error out, but I took the easy way out for the tutorial.

tonma wrote:
And I wish to use PAL4BPP image to load more images :
I change the setup_palette to load th good palette number and in the draw_sprite function, I change :
Code:
pvr_poly_cxt_txr(&context, PVR_LIST_PT_POLY, PVR_TXRFMT_PAL4BPP | PVR_TXRFMT_4BPP_PAL(palette_number), sheet->width, sheet->height, sheet->texture, PVR_FILTER_NONE);


The emulator crash when it comes to the spritesheet_load function at :
Code:
/* Only allow 8 bit palette dtex files */
   if(memcmp(dtex_header.magic, "DTEX", 4) || dtex_header.type != 0x30000000) {
      result = 3;
      goto cleanup;
   }


How can I allow 4 bit pallette ?


In the tutorial I mentioned "The DTEX and DPAL file formats are documented in texconv's readme", which you can find here: https://github.com/tvspelsfreak/texconv ... readme.txt
Read the section "TEXTURE FILE FORMAT".
The first 8 bytes are id, width and height, then you find the "type".

Code:
bits 27-29 : Pixel format
...
   5 = PAL4BPP
   6 = PAL8BPP

0x30000000 is 0b110000000000000000000000000000, in other words 6 = 0b110 shifted 27 bits to the left.
5 is 0b101 so I think you need 5 << 27 = 0x28000000.
You can verify this with a hex editor.

_________________
Wiki & tutorials: http://dcemulation.org/?title=Development
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream


Top
 Profile  
Reply with quote  
 Post subject: Re: Wiki feedback
PostPosted: Tue Apr 19, 2016 10:19 am 
Offline
DCEmu Junior
DCEmu Junior

Joined: Thu Mar 10, 2016 6:14 am
Posts: 41
Thank you so much, it's clearer for my little brain. :oops: I still have much to learn.

My other modifications work perfectly. I can mix between palettes. :mrgreen:


Top
 Profile  
Reply with quote  
 Post subject: Re: Wiki feedback
PostPosted: Mon Apr 25, 2016 2:37 am 
Offline
DCEmu Junior
DCEmu Junior

Joined: Thu Mar 10, 2016 6:14 am
Posts: 41
For the tutorial "PVR spritesheet animation". I found a bug if you load spritesheet again and again.

You forgot the fclose at the end of the function spriteheet_load :
Code:
if(image_file)   fclose(image_file);
if(palette_file) fclose(palette_file);
if(sheet_file)   fclose(sheet_file);


Top
 Profile  
Reply with quote  
 Post subject: Re: Wiki feedback
PostPosted: Mon Apr 25, 2016 3:39 pm 
Offline
Moderator
Moderator
User avatar

Joined: Sun Apr 20, 2014 7:45 am
Posts: 567
tonma, thank you for pointing that out.
I only called fclose upon error. Obviously I did not test that function at all.. I was even considering not putting it in at all out of laziness. Sorry for causing confusion :)

Code:
Fix: fclose in spritesheet_free() upon success as well
add comment for TexturePacker divisor
add converted files and executable so that no compilation/conversion is necessary

_________________
Wiki & tutorials: http://dcemulation.org/?title=Development
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream


Top
 Profile  
Reply with quote  
 Post subject: Re: Wiki feedback
PostPosted: Tue Apr 26, 2016 1:21 am 
Offline
DCEmu Junior
DCEmu Junior

Joined: Thu Mar 10, 2016 6:14 am
Posts: 41
No problem. It allows me to learn :mrgreen:


Top
 Profile  
Reply with quote  
 Post subject: Re: Wiki feedback
PostPosted: Fri May 06, 2016 12:22 pm 
Offline
DCEmu Freak
DCEmu Freak

Joined: Wed Feb 05, 2014 4:58 am
Posts: 59
That wiki is priceless. :)


Top
 Profile  
Reply with quote  
 Post subject: Re: Wiki feedback
PostPosted: Tue Aug 30, 2016 3:24 pm 
Offline
Moderator
Moderator
User avatar

Joined: Sun Apr 20, 2014 7:45 am
Posts: 567
I added "Compiling KOS on OS X" and uploaded the kos_setup_script.sh to the wiki, also added it to the Linux guide.
If there are any issues with the installer in the future, you may just update that shell script.

_________________
Wiki & tutorials: http://dcemulation.org/?title=Development
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream


Top
 Profile  
Reply with quote  
 Post subject: Re: Wiki feedback
PostPosted: Wed Sep 07, 2016 5:21 am 
Offline
Moderator
Moderator
User avatar

Joined: Sun Apr 20, 2014 7:45 am
Posts: 567
Made two changes to the installer script:
- Disallow root. The script should be run as sh kos_setup_script.sh. A user was confused by his web browser being opened as root when opening the documentation at the end of the script.
- Check for required software at start, to save people from bad surprises later (I was missing makeinfo on a fresh Debian machine..). I think I've covered most required programs but surely not all.

_________________
Wiki & tutorials: http://dcemulation.org/?title=Development
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream


Top
 Profile  
Reply with quote  
 Post subject: Re: Wiki feedback
PostPosted: Thu Sep 15, 2016 11:00 am 
Offline
Moderator
Moderator
User avatar

Joined: Sun Apr 20, 2014 7:45 am
Posts: 567
I've rewritten the "Compiling on Windows" tutorial, it uses MSYS2 now instead of Cygwin. I've also updated the script for Linux/Mac/Windows.

Changes to the script:
  • Support for MSYS2 Windows builds
  • Check for more required programs
  • Auto-install packages on Fedora (untested)
  • Auto-install packages on Debian
  • Download new config.{guess,sub} to detect more systems in autoconf
  • Documentation will also open in firefox or chromium if x-www-browser is not installed.

I'd appreciate if somebody could try the installer on Windows, Debian-derived systems, Fedora and everything else you can throw at it.
Up to now it has been tested on Debian 64 bit, OSX 10.7 64 bit, Windows XP 32 bit and Ubuntu (to my knowledge).

The old Cygwin tutorial I assembled from a forum post by ph3nom is at the bottom of the page.

_________________
Wiki & tutorials: http://dcemulation.org/?title=Development
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream


Top
 Profile  
Reply with quote  
 Post subject: Re: Wiki feedback
PostPosted: Fri Sep 16, 2016 7:33 pm 
Offline
The Crabby Overlord
The Crabby Overlord
User avatar

Joined: Mon May 27, 2002 9:31 am
Posts: 5208
I've edited the page to point out that the dev iso and code::blocks setups are extremely old and shouldn't be used for any current development.

I'd really rather not have a bunch of questions from people using them and running into problems again (that's why I unstuck the topics from this forum a while back). The way the page was phrased at that section made it seem like we were recommending them, which would not be something we should be doing (unless someone really does want to support really old versions of stuff -- I know that I don't).


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

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 5 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