Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
100 user(s) are online (86 user(s) are browsing Forums)

Members: 0
Guests: 100

more...

Headlines






Detecting if a 68k prog is running on os4 ?
Not too shy to talk
Joined:
2011/6/3 13:49
Posts: 269
Hello

I have made a program GMAP for both OS3 68k and OS4 ppc

GMAP-os3 run well on OS3
GMAP-os4 run well on OS4

but GMAP-os3 got a bug when running on OS4

I can easily fix this bug if I can detect that this 68k prog is now running on OS4....
But how to detect that ?

Alain Thellier

   Report Go to top

Re: Detecting if a 68k prog is running on os4 ?
Just can't stay away
Joined:
2006/11/30 11:30
From Finland
Posts: 1804
@thellier

The following should work for identifying AmigaOS 4.x while excluding MorphOS which also uses version numbers >= 50.

if (((struct Library *)SysBase)->lib_Version >= 50 && !FindResident("MorphOS")) {
    
/* AmigaOS 4.x */
}


This still might give a false positive for 68k AROS though...

   Report Go to top

Re: Detecting if a 68k prog is running on os4 ?
Not too shy to talk
Joined:
2006/11/26 17:45
Posts: 279

Even if the bug only shows on OS4, it is still a bug. You should fix it properly and not work around it.


   Report Go to top

Re: Detecting if a 68k prog is running on os4 ?
Home away from home
Joined:
2006/11/20 16:26
From Norway
Posts: 2987
@thellier

Way do you want to run less efficient 68k version on a powerpc cpu?

How about checking CPU, if you have a PowerPC, then it's not running on AmigaOS3.x, or you check if a system file is a ELF file, that’s easy as its first bytes in program file.

_________________
(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
   Report Go to top

Re: Detecting if a 68k prog is running on os4 ?
Just popping in
Joined:
2007/6/5 14:51
From Brisbane, AUSTRALIA
Posts: 105

There are several things you can do to determine this, but what I would
really like to know is.... Why ?

If you know what it is that is "easily fixed" if you could detect the OS4
68K emulator, would you mind telling us, what it is that makes the
OS4 68K emulator somehow incompatible with your 68K app. ?

To me, it initially sounds like some "side effect" is being exploited,
that either doesn't exist anymore or is no longer supported on OS4,
or the OS4 68K emulator has some compatibility limitation that could
perhaps be fixed.

Trying to write apps that need to use work-arounds, doesn't sound like
a robust methodology to me.


   Report Go to top

Re: Detecting if a 68k prog is running on os4 ?
Not too shy to talk
Joined:
2011/6/3 13:49
Posts: 269
@salass00
Thanks

>Way do you want to run less efficient 68k version on a powerpc cpu?
1) Because the GMAP users try also the os3 version and complain "os3 version dont works on os4"
2) Because I want it to be fixed and not release bugged softwares
3) Because you CAN run the os3 version...

>Trying to write apps that need to use work-arounds

In fact the problem is NOT in my code but within the PNG datatype used

I use the same
bpa.MethodID = PDTM_READPIXELARRAY;
bpa.pbpa_PixelData = T->pixels;
bpa.pbpa_PixelFormat = PBPAFMT_ARGB;
[...]
on os3 and os4
But GMAP-os3 running on OS4 dont give the RGB pixels with background color where pixels are transparent but the transparent color itself
I mean if the "sprites" are surrounded with a purple transparent color then I obtain purple not the workbench grey

This is very strange as it only happen in this case
I mean:
GMAP-os3 run well on OS3
GMAP-os4 run well on OS4

Alain Thellier




   Report Go to top

Re: Detecting if a 68k prog is running on os4 ?
Just popping in
Joined:
2007/6/5 14:51
From Brisbane, AUSTRALIA
Posts: 105
Do you have any local structures defined in your program (without packing)
that are referenced outside of your own code,. (ie; by system functions) ?

The reason I mention this is because if you look at the OS4 includes,
you will notice that there are blocks like this in the include files;

#ifdef __GNUC__
#ifdef __PPC__
#pragma pack(2)
#endif
#elif defined(__VBCC__)
#pragma amiga-align
#endif

If you have mixed size members (or <32 bit sized members) in locally
defined structures, the alignment padding can differ and some members
of the structures may not be where you think they are, because of the
invisible alignment padding being added.




   Report Go to top

Re: Detecting if a 68k prog is running on os4 ?
Not too shy to talk
Joined:
2011/6/3 13:49
Posts: 269
@colinw

No no structures seems ok

   Report Go to top

Re: Detecting if a 68k prog is running on os4 ?
Just can't stay away
Joined:
2006/11/24 18:52
From Gloucestershire, UK.
Posts: 1172
@thellier

Only an end user guess but on OS4 you probably have to look at the Alpha levels as they have much more support under OS4 than OS3.


_________________
Amiga user since 1985
AOS4, A-EON, IBrowse & Alinea Betatester

Ps. I hate the new amigans website. <shudder>
   Report Go to top

Re: Detecting if a 68k prog is running on os4 ?
Not too shy to talk
Joined:
2011/6/3 13:49
Posts: 269
salass00 method allow me to add a fix
So case is closed

Thanks to all

Alain Thellier

   Report Go to top

Re: Detecting if a 68k prog is running on os4 ?
Quite a regular
Joined:
2013/10/17 16:21
From Hungary
Posts: 675
Revisiting this topic, is there a more reliable way to do this other than checking the SysBase version? Before we get sidetracked about fixing my code and why I want to do this, I'd like to avoid h/w banging code from crashing if my program was started on OS4.
The exec.library version check alone won't be enough as we have forks and clones. For example 68k AROS is at 51.3, the 3.2 team has also bumped the main versions to 47, so maybe they will hit 50 with future versions. How could I avoid false positives? Is there a public port, semaphore, or component I could check, that's unique to OS4?

_________________
This is just like television, only you can see much further.
   Report Go to top

Re: Detecting if a 68k prog is running on os4 ?
Just can't stay away
Joined:
2007/7/14 21:30
From Lothric
Posts: 1349
@BSzili

Would FindTask("idle.task") work?

   Report Go to top

Re: Detecting if a 68k prog is running on os4 ?
Quite a regular
Joined:
2007/2/6 13:57
From Donostia (SPAIN)
Posts: 652
check for elf.library?

   Report Go to top

Re: Detecting if a 68k prog is running on os4 ?
Quite a regular
Joined:
2013/10/17 16:21
From Hungary
Posts: 675
Thanks for the suggestions, I'll try these later in WinUAE.

_________________
This is just like television, only you can see much further.
   Report Go to top

Re: Detecting if a 68k prog is running on os4 ?
Quite a regular
Joined:
2013/10/17 16:21
From Hungary
Posts: 675
I ended up going with:
if (((struct Library *)SysBase)->lib_Version >= 50 && (FindResident((STRPTR)"elf.library") || FindResident((STRPTR)"MorphOS"))) {
    
// AmigaOS4 or MorphOS
}

which does the job I think.

_________________
This is just like television, only you can see much further.
   Report Go to top





[Advanced Search]



Powered by XOOPS 2.0 © 2001-2016 The XOOPS Project