07 May 2013, 03:50 | #1 |
Registered User
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 4,400
|
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:
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. |
07 May 2013, 06:56 | #2 |
BlizzardPPC'less
|
A for the effort dude ! Sounds very good.
Could this be used with existing sdl apps/games also? |
07 May 2013, 07:41 | #3 | |
Registered User
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 4,400
|
Quote:
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 |
|
07 May 2013, 13:08 | #4 |
Phone Homer
Join Date: Jun 2006
Location: 5150
Posts: 5,773
|
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
|
07 May 2013, 13:25 | #5 |
Going nowhere
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 8,987
|
Again, Kudos Novacoder, great work.
Just how much typical development time will be saved doing it this way do you think? |
07 May 2013, 13:34 | #6 |
Registered User
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 4,400
|
Best case, maybe 50%
|
07 May 2013, 14:06 | #7 |
Going nowhere
Join Date: Oct 2001
Location: United Kingdom
Age: 50
Posts: 8,987
|
|
07 May 2013, 14:38 | #8 | |
Registered User
Join Date: Aug 2007
Location: berlin/germany
Posts: 1,054
|
Quote:
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. |
|
07 May 2013, 17:53 | #9 |
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 |
07 May 2013, 22:43 | #10 |
Registered User
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 4,400
|
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. |
08 May 2013, 07:06 | #11 |
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 |
08 May 2013, 13:38 | #12 |
Registered User
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 4,400
|
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. |
09 May 2013, 15:27 | #13 |
Registered User
Join Date: Feb 2013
Location: Dublin/Ireland
Posts: 403
|
Great stuff Novacoder.
Last edited by prowler; 09 May 2013 at 21:53. Reason: Fixed quote. |
10 May 2013, 06:07 | #14 |
Registered User
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 4,400
|
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 |
11 May 2013, 14:21 | #15 |
Registered User
Join Date: Oct 2007
Location: Bratislava / Slovakia
Posts: 34
|
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. |
11 May 2013, 19:23 | #16 |
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. |
21 May 2013, 02:37 | #17 |
Registered User
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 4,400
|
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. |
21 May 2013, 23:29 | #18 |
AmigaMan
Join Date: Oct 2012
Location: Castro Urdiales/Spain
Posts: 760
|
You are the king! Hope to play with it soon! Thanks for the efford!
|
22 May 2013, 01:40 | #19 |
Ruler of the Universe
Join Date: Mar 2010
Location: Lanzarote/Spain
Posts: 6,185
|
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. |
22 May 2013, 02:51 | #20 |
Registered User
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 4,400
|
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. |
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 ...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 |
|
|