31 December 2017, 02:05 | #1 |
Registered User
Join Date: Mar 2016
Location: Australia
Posts: 881
|
Converting a "system-takeover" game to OS friendly
Hi,
I have been working on a new option for an up-coming game to provide an OS friendly configuration (as opposed to system-takeover) for those with a bit of extra CPU and external devices that can cause problems for "system-takeover" games and demos (I'm looking at you TCP/IP and USB stacks!). Note: I will still be supporting the "system-takeover" versions for lower spec machines or those that don't care about running a TCP stack behind a game. I took my info mainly from "howtocode7" as well as the gloom source code and some EAB posts on various things like keyboard input. I have made a bunch of changes and so-far with the exception of a small performance hit on slower CPUs it seems to be working. But I thought I would outline what I did in case anyone can make any suggestions or see's something I have missed. So this is what I did:
So far from the testing I have done, it seems to be working well both in emulation and on real hardware, however I don't have any hardware that creates unwanted interrupts (not sure if my PCMCIA card generates PORTS interrupts). Any suggestions would be greatly appreciated |
31 December 2017, 10:11 | #2 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
To be 100% sure you do not have to worry at all about unwanted interrupts, TCP/USB stacks, special keyboard drivers, etc, you can :
- Open an Intuition screen and a backdrop/borderless window on it. - Use IDCMP messages rather than input.device. - Allocate audio with audio.device (then you can touch audio HW). - Own blitter only when you use it, not for the whole program's duration. Or better, not use the blitter at all if you know the machine has a fast CPU. - Do not touch task priority (no real positive impact on accelerated machines and it could block an important task). - Use system calls like WaitTOF() rather than empty polling loops, for timing. I also humbly suggest you isolate everything that is accessing hardware or OS into some kind of system framework, so that you can reuse it at will for all future projects. |
31 December 2017, 10:23 | #3 | |
Registered User
Join Date: Mar 2016
Location: Australia
Posts: 881
|
Quote:
I’ll look into allocating the audio, seems the polite thing to do. Thanks for the pointers. |
|
31 December 2017, 10:44 | #4 | |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
Quote:
It is also a lot easier to use the mouse. And anyway it allows your program to multitask happily. You can then use Amiga-M to return to OS (for whatever task you want to do) without quitting the game, grab the screen with any Amiga screen grabber, use tools such as Snoopdos/Enforcer, etc. I haven't done it myself, but you could add support for gfx cards as well. |
|
31 December 2017, 10:49 | #5 | |
Registered User
Join Date: Mar 2016
Location: Australia
Posts: 881
|
Quote:
It’s a little bit complicated by the fact that the same code base does the trackloaded A500 version. |
|
31 December 2017, 10:56 | #6 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,164
|
why not writing a whdload slave for your OS friendly game?
|
31 December 2017, 11:04 | #7 |
Registered User
Join Date: Mar 2016
Location: Australia
Posts: 881
|
I’ll admit I don’t know much about whdload (other than how to run it), but from what I can see whdload suffers from this same limitations as my “system takeover” games. i.e needing to shut down tcp stacks etc? Correct me if I’m wrong?
|
31 December 2017, 11:11 | #8 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
Right, whdload indeed takes over the system.
|
31 December 2017, 11:41 | #9 |
Registered User
Join Date: Mar 2016
Location: Australia
Posts: 881
|
|
31 December 2017, 12:10 | #10 | |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
Quote:
Else it switches to/from OS, like when saving a game. Makes black screen and stopped sound while performing disk accesses. |
|
31 December 2017, 12:13 | #11 |
Registered User
Join Date: Mar 2016
Location: Australia
Posts: 881
|
Right that’s how my system takeover version works. One big advantage of leaving the OS running is the ability to do disk io nicely.
|
31 December 2017, 23:02 | #12 |
Registered User
Join Date: Mar 2016
Location: Australia
Posts: 881
|
So it seems that the P6112 player allocates the audio.device when in system friendly mode.
During my testing however it seems some apps don't correctly respect the allocation protocol (either they don't allocate audio, or don't correctly respond to a channel being "stolen"). |
01 January 2018, 01:04 | #13 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,164
|
whdload main advantage is that it does everything properly AND supports MMU (on some machines there's remapping of the zero page, which crashes the games if you don't cancel it because VBR is there )
Black screen is annoying only if there's a lot of data to load. For hiscore saving, if the original file is full of zeroes but saving scores doesn't change the file size, you won't even have black/flash screen. Scores will be saved when exiting the program. of course, all TCP stacks are killed (but whdload provides ability to execute startup & end scripts to handle external hardware if needed, well, the user must adapt to his config) |
01 January 2018, 01:06 | #14 | |
Registered User
Join Date: Mar 2016
Location: Australia
Posts: 881
|
Quote:
I always test on MMU so I can use Enforcer. |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
"Voices8" 8 Channel Soundtracker "DemoSongI" song - "This is the Amiga with 8 Voices" | DemosongIHunter | request.Music | 45 | 23 May 2022 20:07 |
Loonies' "Hotstyle Takeover" breaks on 3.5.0 | Foebane | support.WinUAE | 39 | 24 September 2017 17:01 |
How "Brick Games" and "Game' n' Watches" works | Leandro Jardim | Retrogaming General Discussion | 2 | 03 August 2013 17:48 |
"Exception "Line 1111 Emulator" ($2c) Error at $1004" when exiting game | demolition | support.WinUAE | 15 | 30 November 2012 16:43 |
Suggestion: "Archive" sub-section for "Looking for a game name" | andreas | project.EAB | 1 | 29 May 2008 01:00 |
|
|