English Amiga Board

English Amiga Board (https://eab.abime.net/index.php)
-   project.Amiga Game Factory (https://eab.abime.net/forumdisplay.php?f=69)
-   -   Nova's SDL Hack (AGA love) (https://eab.abime.net/showthread.php?t=69103)

NovaCoder 07 May 2013 03:50

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 :D

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

Bamiga2002 07 May 2013 06:56

A for the effort dude :great! Sounds very good.
Could this be used with existing sdl apps/games also?

NovaCoder 07 May 2013 07:41

Quote:

Originally Posted by Bamiga2002 (Post 886408)
A for the effort dude :great! 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 Red Alert and Ultima 7, that would be very cool on AGA :agree

Retro1234 07 May 2013 13:08

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 :)

Galahad/FLT 07 May 2013 13:25

Again, Kudos Novacoder, great work.

Just how much typical development time will be saved doing it this way do you think?

NovaCoder 07 May 2013 13:34

Best case, maybe 50%

Galahad/FLT 07 May 2013 14:06

Quote:

Originally Posted by NovaCoder (Post 886484)
Best case, maybe 50%

Great stuff :great

wawa 07 May 2013 14:38

Quote:

Originally Posted by NovaCoder (Post 886401)
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 :D

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.

fishyfish 07 May 2013 17:53

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 :)

NovaCoder 07 May 2013 22:43

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.

fishyfish 08 May 2013 07:06

@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 :)

NovaCoder 08 May 2013 13:38

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.

Reido 09 May 2013 15:27

Quote:

Originally Posted by NovaCoder (Post 886411)
I'm already thinking of some new AGA SDL ports like Red Alert and Ultima 7, that would be very cool on AGA :agree

Great stuff Novacoder.

NovaCoder 10 May 2013 06:07

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


mikro 11 May 2013 14:21

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.

fishyfish 11 May 2013 19:23

@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.

NovaCoder 21 May 2013 02:37

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 :)

tolkien 21 May 2013 23:29

You are the king! Hope to play with it soon! Thanks for the efford!

Retrofan 22 May 2013 01:40

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 ... :agree

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

NovaCoder 22 May 2013 02:51

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.


All times are GMT +2. The time now is 09:55.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.

Page generated in 0.11804 seconds with 11 queries