English Amiga Board Amiga Lore


Go Back   English Amiga Board > Other Projects > project.Amiga Game Factory

 
 
Thread Tools
Old 07 May 2013, 03:50   #1
NovaCoder
Registered User
NovaCoder's Avatar
 
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 3,406
Nova's SDL Hack (AGA love)

This is a thread to talk about my new SDL library which is a cut-down version made for good old AGA Amiga's (like mine).

As people know I've ported a few games now and usually I have to rip out all of the SDL code and replace it with my own Amiga code. This can be a very time consuming process so I decide to give an SDL library port one more try.

I've managed to knock together a working AGA SDL library and I'm using it to port Descent Rebirth to AGA.

Currently the plan is to support at least these SDL functions:

Graphics (double buffered using C2P assembler), Keyboard, mouse & joystick input

Not so sure about sound, threading and timers yet.


Restrictions:

  1. Only AGA 8 bit full-screen modes supported (320x200 -> 640x480).
  2. No CDROM support
  3. No OpenGL (obviously)
  4. No hardware accelerated graphics (again, kind of obvious)


This library is already being used to port NetSurf to AGA

If I can get this working properly it should make it much easier to port a lot of new stuff to AGA quickly

Last edited by NovaCoder; 07 May 2013 at 03:59.
NovaCoder is offline  
AdSense AdSense  
Old 07 May 2013, 06:56   #2
Bamiga2002
BlizzardPPC'less

Bamiga2002's Avatar
 
Join Date: May 2004
Location: Finland
Age: 39
Posts: 3,211
Send a message via MSN to Bamiga2002
A for the effort dude ! Sounds very good.
Could this be used with existing sdl apps/games also?
Bamiga2002 is offline  
Old 07 May 2013, 07:41   #3
NovaCoder
Registered User
NovaCoder's Avatar
 
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 3,406
Quote:
Originally Posted by Bamiga2002 View Post
A for the effort dude ! Sounds very good.
Could this be used with existing sdl apps/games also?
Yep that's the theory, I normally use the 68k RTG SDL to port SDL games just to see if they will work on 68k. I then have to spend time removing all of that SDL code which is very boring.

If I can get this AGA library working properly, it will make the whole porting process much quicker.

I'm already thinking of some new AGA SDL ports like [ Show youtube player ] and [ Show youtube player ], that would be very cool on AGA
NovaCoder is offline  
Old 07 May 2013, 13:08   #4
Retro1234
5150

Retro1234's Avatar
 
Join Date: Jun 2006
Location: Sycophantazia
Posts: 3,666
I think Heart of the Alien would be great but if the SDL library helps us use SDL stuff in general on AGA its got to be a good thing
Retro1234 is offline  
Old 07 May 2013, 13:25   #5
Galahad/FLT
Going nowhere

Galahad/FLT's Avatar
 
Join Date: Oct 2001
Location: United Kingdom
Age: 43
Posts: 6,463
Again, Kudos Novacoder, great work.

Just how much typical development time will be saved doing it this way do you think?
Galahad/FLT is online now  
Old 07 May 2013, 13:34   #6
NovaCoder
Registered User
NovaCoder's Avatar
 
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 3,406
Best case, maybe 50%
NovaCoder is offline  
Old 07 May 2013, 14:06   #7
Galahad/FLT
Going nowhere

Galahad/FLT's Avatar
 
Join Date: Oct 2001
Location: United Kingdom
Age: 43
Posts: 6,463
Quote:
Originally Posted by NovaCoder View Post
Best case, maybe 50%
Great stuff
Galahad/FLT is online now  
Old 07 May 2013, 14:38   #8
wawa
Registered User
 
Join Date: Aug 2007
Location: berlin/germany
Posts: 869
Quote:
Originally Posted by NovaCoder View Post
This is a thread to talk about my new SDL library which is a cut-down version made for good old AGA Amiga's (like mine).

As people know I've ported a few games now and usually I have to rip out all of the SDL code and replace it with my own Amiga code. This can be a very time consuming process so I decide to give an SDL library port one more try.

I've managed to knock together a working AGA SDL library and I'm using it to port Descent Rebirth to AGA.

Currently the plan is to support at least these SDL functions:

Graphics (double buffered using C2P assembler), Keyboard, mouse & joystick input

Not so sure about sound, threading and timers yet.


Restrictions:

  1. Only AGA 8 bit full-screen modes supported (320x200 -> 640x480).
  2. No CDROM support
  3. No OpenGL (obviously)
  4. No hardware accelerated graphics (again, kind of obvious)


This library is already being used to port NetSurf to AGA

If I can get this working properly it should make it much easier to port a lot of new stuff to AGA quickly
i understand you are hitting the hardware here with assembler. the handicap would be that only aga and certain resolutions are supported, which means every one configuration would need and own independent port/compile. i wonder if a (sort of universal) sdl wrapper link library could be made translating whats possible of sdl to gfx library calls. this way flexibility might be maintained (aga/rtg, different resolutions and depths, window/fullscreen) and we would avoid versions hell.

i know this is probably too much to demand, but i think starting the project like that things should be considered as to minimize effort and maximize the effect.
wawa is offline  
Old 07 May 2013, 17:53   #9
fishyfish
Banned
 
Join Date: Jul 2010
Location: Australia
Posts: 475
Word of warning,..... open c&c, and inheritantly FreeRA arent particularly stable. Mightve improved in recent times, but they werent great last time I tried them.

Marathon might be nice to have though, as would Hexen2. Not requests, Im just thinking aloud

As for my DGen port, it's actually semi playable already even on my 40mhz '040. I suspect that'll change though once I enable sound
fishyfish is offline  
Old 07 May 2013, 22:43   #10
NovaCoder
Registered User
NovaCoder's Avatar
 
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 3,406
hiya,

I'll do a new 040 build for you, should be much better, still without sound though. Can you confirm your DGen port doesn't use the SDL Timer?



I'm going to be looking at NetSurf AGA next to see what it needs, then I'll look into adding sound/joystick support.

Last edited by NovaCoder; 08 May 2013 at 23:16.
NovaCoder is offline  
Old 08 May 2013, 07:06   #11
fishyfish
Banned
 
Join Date: Jul 2010
Location: Australia
Posts: 475
@Novacoder

Thanks.
Nah, Dgen doesnt use SDL timers.
As for joystick support I seem to recall the old SDL used lowlevel.lib for joystick support on OS3.x?

Good stuff, and thanks again
fishyfish is offline  
Old 08 May 2013, 13:38   #12
NovaCoder
Registered User
NovaCoder's Avatar
 
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 3,406
Ok let me know how you get on with it, if you can get it working it should be a bit faster.

I'll probably have to add both Timers and Threads back in soon, looks like NetSurf needs Timers which means you also need to support Threading. The SDL is a bit of mess to work with, it's very hard to see what things it actually needs enabled.

I keep finding what I think are bugs in the library but so far they are mostly bugs with the Descent port I'm working on, this is actually a big pain in the butt because it's hard to develop a new library and port something at the same time. In hindsight, I should have gone for something that was already working properly with the existing 68k RTG SDL when running in 8 bit mode and then used that to develop the AGA SDL.

Last edited by NovaCoder; 09 May 2013 at 05:13.
NovaCoder is offline  
Old 09 May 2013, 15:27   #13
Reido
Registered User

 
Join Date: Feb 2013
Location: Dublin/Ireland
Posts: 227
Quote:
Originally Posted by NovaCoder View Post
I'm already thinking of some new AGA SDL ports like [ Show youtube player ] and [ Show youtube player ], that would be very cool on AGA
Great stuff Novacoder.

Last edited by prowler; 09 May 2013 at 21:53. Reason: Fixed quote.
Reido is offline  
Old 10 May 2013, 06:07   #14
NovaCoder
Registered User
NovaCoder's Avatar
 
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 3,406
As painful as crawling over broken glass but I think I've managed to get Threading and Timers enabled (they were enabled in the old 68k library but weren't very pretty).

Code:
[AGA_CreateDevice]: devindex = 0
[SDL_VideoInit]: Initialize the video subsystem
[AGA_VideoInit]: START
[SDL_VideoInit]: Create a zero sized video surface of the appropriate format
[SDL_AllocFormat]: bpp=8 ncolors=256
[SDL_VideoInit]: Start the event loop
[SDL_StartEventLoop]: Clean out the event queue
[SDL_StartEventLoop]: No filter to start with, process most event types
[SDL_StartEventLoop]: It's not safe to call SDL_EventState() yet
[SDL_StartEventLoop]: Initialize event handlers
[SDL_StartEventLoop]: Create the lock and event thread
[SDL_StartEventThread]: START
[SDL_StartEventThread]: Create the lock and set ourselves active
[SDL_CreateMutex]: START
[SDL_CreateMutex]: Create the mutex semaphore, with initial value 1
[SDL_CreateMutex]: Creating sem
[SDL_CreateMutex]: Created sem
[SDL_CreateMutex]: InitSemaphore
[SDL_CreateMutex]: Inited Semaphore
[SDL_CreateMutex]: returning sem
[SDL_CreateMutex]: FINI
[SDL_VideoInit]: Calling SDL_CursorInit
[SDL_CursorInit]: SDL_CursorInit()
[SDL_CursorInit]: Create the default cursor
[SDL_SetCursor]: Called with valid Cursor
[SDL_SetCursor]: Draw the new mouse cursor
[SDL_SetCursor]: CURSOR_USINGSW
[SDL_TimerInit]:  SDL_timer not already threaded, calling SDL_SYS_TimerInit()
[SDL_AddThread]: Threads already allocated(0) - max threads(0)
[SDL_AddThread]: Expanding the list of threads
[SDL_AddThread]: Threads allocated(1) - max threads(32)
[SDL_CreateThread]: Starting thread with args 102380c4...
[SDL_SYS_CreateThread]: Sending 102380c4 to the new thread...
[SDL_TimerInit]:  SDL_timer started
SDL_SetVideoMode(width=320, height=240, bpp=8)
AGA_SetVideoMode(width=320, height=240, bpp=8)
AGA_SetVideoMode() SDL_HWSURFACE requested
AGA_SetVideoMode() SDL_HWPALETTE requested
AGA_SetVideoMode() SDL_DOUBLEBUF requested
AGA_SetVideoMode() SDL_FULLSCREEN requested
AGA_SetVideoMode() SDL_RESIZABLE NOT requested
Setting mode 320x240
[SDL_AllocFormat]: bpp=8 ncolors=256
SDL_SetVideoMode: surface depth of SDL_VideoSurface 8 
AGA_SetColors()
AGA_SetColors() - firstcolor = 0
AGA_SetColors() - ncolors = 256
AGA_updatePalette()
AGA_updatePalette() - _paletteDirtyStart = 0
AGA_updatePalette() - _paletteDirtyEnd = 256
Requested mode: 320x240x8, obtained mode 320x240x8 (offset 0)
SDL_SetVideoMode() - Reset the mouse cursor and grab for new video mode
[SDL_SetCursor]: Called with NULL Cursor
[SDL_SetCursor]: Draw the new mouse cursor
[AGA_ShowWMCursor]: Showing Cursor
[SDL_ShowCursor]: SDL_ShowCursor(toggle = SDL_DISABLE)
[SDL_ShowCursor]: Hiding Cursor
[SDL_SetCursor]: Called with NULL Cursor
[SDL_SetCursor]: Erase window manager mouse (cursor not visible)
[SDL_SetCursor]: ShowWMCursor
[AGA_ShowWMCursor]: Hiding Cursor
[SDL_AllocFormat]: bpp=8 ncolors=256
[SDL_ConvertSurface]: 8 0 0
[SDL_AllocFormat]: bpp=8 ncolors=256
[SDL_SetPalette]: which=3, firstcolor=0, ncolors=256
[SetPalette_logical]: firstcolor=0, ncolors=256
[SetPalette_physical]: firstcolor=0, ncolors=256
AGA_SetColors()
AGA_SetColors() - firstcolor = 0
AGA_SetColors() - ncolors = 256
AGA_updatePalette()
AGA_updatePalette() - _paletteDirtyStart = 0
AGA_updatePalette() - _paletteDirtyEnd = 256
[SDL_ShowCursor]: SDL_ShowCursor(toggle = SDL_ENABLE)
[SDL_ShowCursor]: Hiding Cursor
[SDL_SetCursor]: Called with NULL Cursor
[SDL_SetCursor]: Draw the new mouse cursor
[AGA_ShowWMCursor]: Showing Cursor
[SDL_Quit]: Quitting all SubSystems
[SDL_SetTimer]: ms = 0
[SDL_DelThread]: Deleting thread, threads left(0) - max threads(32)
SDL_FreeCursor()
AGA_VideoQuit()
[AGA_DeleteDevice]: START
NovaCoder is offline  
Old 11 May 2013, 14:21   #15
mikro
Registered User
 
Join Date: Oct 2007
Location: Bratislava / Slovakia
Posts: 30
Btw, you seem to have the exactly same ideas as I do I've made something very similar but never finished it.

A bit of warning, though: audio is a very tricky thing, at least on our platforms. There's an official Atari port of SDL (it's even in the official SVN repo) but audio is not very realiable, for two reasons:

1. You often need SDL_Mixer for some games (OpenTyrian comes to my mind but many others, too) what leads to noticable slowdown

2. It uses to crash and it's not a trivial bug: http://pmandin.atari.org/dotclear/in...audio-on-atari

Anyway, I'd love to see fruits of your work as the official Atari SDL is done right "too much", i.e. it's always slower than if you code your own double buffer & stuff.
mikro is offline  
Old 11 May 2013, 19:23   #16
fishyfish
Banned
 
Join Date: Jul 2010
Location: Australia
Posts: 475
@Novacoder

Sorry, Ive been busy the last few days so havent had a chance to try the new version of the lb you compiled for me. I'll let you know how I go when I get around to trying it.

Also, a bit off topic, but I stumbled across this open source Syndicate Wards engine just before:

http://swars.vexillium.org/#download

I used to play it on a pentium 133 back in the day and that was a bit too fast in low res, so assuming this open source engine is similarly speedy it should be playable on an '060/aga machine.

Definitely something Im going to try to remember to check out. Judging by the dependencies listed on the website it should be fairly portable.
fishyfish is offline  
Old 21 May 2013, 02:37   #17
NovaCoder
Registered User
NovaCoder's Avatar
 
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 3,406
I've been making a bit more progress on this, I think it's almost 'finished' now. As in finished for a 'bit of a hack'

It will support the following: Events, Graphics, Sound and Threading
Will not support: Timers (too slow and crappy) or the SDL mixer (too hard, see above)

As some of you know, I've been using it to help port Descent Rebirth to AGA and that game seems to be holding together ok so far. As another test, I tried to build DosBox v0.74 with my library and the sound and graphics were fine but I did find some bugs in my library with the keyboard handling (which I've now fixed). It was quite a nice test actually because it only took 10 mins of updates to go from the existing RTG SDL to a working DosBox using my AGA version

Next up I'm probably going to have a little go with an Exult port to help test my SDL library further.

I'm now thinking that if I were take the RTG graphics code from the existing SDL library and then copy that code into my version it would give us 2 fast SDL versions for 68k ports

Last edited by NovaCoder; 21 May 2013 at 06:45.
NovaCoder is offline  
Old 21 May 2013, 23:29   #18
tolkien
AmigaMan

tolkien's Avatar
 
Join Date: Oct 2012
Location: Castro Urdiales/Spain
Posts: 433
You are the king! Hope to play with it soon! Thanks for the efford!
tolkien is offline  
Old 22 May 2013, 01:40   #19
Retrofan
Ruler of the Universe

Retrofan's Avatar
 
Join Date: Mar 2010
Location: Lanzarote/Spain
Posts: 5,581
Send a message via Skype™ to Retrofan
Yes, Arti and you are doing an incredible job for NetSurf to work. I'm following this thread as surely others (well, I post more) are doing without "reposting" that we are awaiting and we are grateful ...

Edit: Yes, I know it won't be just for NetSurf.

Last edited by Retrofan; 22 May 2013 at 03:28.
Retrofan is offline  
Old 22 May 2013, 02:51   #20
NovaCoder
Registered User
NovaCoder's Avatar
 
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 3,406
Hiya,

I don't think many people even see this thread because it's all the way down the board

Yep Atri is doing a great job, NetSurf is a complete bitch to compile. I tried to build it myself once but didn't really get very far.

I still keep finding little bugs with my SDL library as I play with my new ports, I found another small issue with the keyboard unicode handling last night. Hopefully if I can fix all of these little bugs then it will be a pretty good 68k SDL implementation.
NovaCoder is offline  
AdSense AdSense  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Nova's Blizzard 1260 NovaCoder Hardware pics 32 09 April 2013 08:17
Nova 9: The Return Of Gir Draxon mai HOL data problems 2 21 November 2009 20:18
Nova's 1200 AGA>VGA Porn...Zetr0 violated! NovaCoder Hardware pics 20 01 September 2009 09:45
No Love Greater than the Love of Moto Zetr0 Hardware pics 15 05 October 2007 18:42
[Fixed] Hard Nova Uukrul HOL data problems 1 17 December 2002 10:12

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 22:38.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Page generated in 0.20026 seconds with 13 queries