Jump to content
IGNORED

Setting/Detecting Screen Rotation


bhall408

Recommended Posts

When developing a lynx game that is intended to be played with the device rotated (Gauntlet for example), do you set a flag to indicate this to the hardware?

 

Or put in reverse, is there something the device looks for to auto-detect that a game is designed for rotated play?

 

Link to comment
Share on other sites

I couldn't see anything to do with rotating a screen. There is support for flipping a screen, but that's not what you're after.

Personally not a huge fan of rotated games, but I guess some like Klax work well.

Yeah, you understand the question.

 

I want to know how (or if) the hardware was able to detect that Gauntlet/Klax/etc were rotated.

 

It is possible the answer is no, but I'm hoping there is a way...

Edited by bhall408
  • Like 1
Link to comment
Share on other sites

Yeah, you understand the question.

 

I want to know how (or if) the hardware was able to detect that Gauntlet/Klax/etc were rotated.

 

It is possible the answer is no, but I'm hoping there is a way...

 

No, it can't detect it. 1989, there were no MEMS gyroscopes or magnetic field sensors as you have in smart phones or tablets. At least, not for a reasonable price. So the Lynx can not detect its orientation or the change of.

Link to comment
Share on other sites

 

No, it can't detect it. 1989, there were no MEMS gyroscopes or magnetic field sensors as you have in smart phones or tablets. At least, not for a reasonable price. So the Lynx can not detect its orientation or the change of.

 

 

I wasn't expecting that the Lynx could detect it's own orientation (which would be common for a modern phone/tablet).

 

What I am hoping, is that perhaps a memory location (register) is set to indicate that a cartridge is expected to be played in the "normal" vs "rotated" orientation.

Link to comment
Share on other sites

For emulation there is a bit in the lnx header telling that the game is rotated. So it is possible to emulate the Lynx correctly on a large screen. But this lnx header is not part of the cart ROM. It is for emulators only.

 

        .segment "EXEHDR"
        .byte   'L','Y','N','X'                         ; magic
        .word   __BLOCKSIZE__                           ; bank 0 page size
        .word   0                                       ; bank 1 page size
        .word   1                                       ; version number
        .asciiz "Cart name                      "       ; 32 bytes cart name
        .asciiz "Manufacturer   "                       ; 16 bytes manufacturer
        .byte   0                                       ; rotation 1=left
                                                        ; rotation 2=right
  • Like 1
Link to comment
Share on other sites

Code can change screen orientation from righthaned to lefthanded (180 degrees rotation) , and (reading in the CC65 sources) this is traced by bit 3 in the SPRSYS register:

 

 

/* SPRSYS (read) $FC92 */
#define MATHWORKING     0x80
#define MATHWARNING     0x40
#define MATHCARRY       0x20
#define VSTRETCHING     0x10
#define LEFTHANDED      0x08
#define UNSAFE_ACCESS   0x04
#define SPRITETOSTOP    0x02
#define SPRITEWORKING 0x01

 

if you're referring to some game being rotated 90 degrees, I think it's only a screen setup from the developer, there is no hw setting for it.

 

But the .lnx file format has an extra header added for emulators that has a byte value that can inform the emulator to preset a 90 dgree rotation (0= no totation, 1= left rotation, 2 = right rotation).

 

Obviously this is only for emulaors, but it's a clue that there isn't the same information on the cart data or there wouldn't be ny need to add it in that header.

  • Like 1
Link to comment
Share on other sites

 

 

I wasn't expecting that the Lynx could detect it's own orientation (which would be common for a modern phone/tablet).

 

What I am hoping, is that perhaps a memory location (register) is set to indicate that a cartridge is expected to be played in the "normal" vs "rotated" orientation.

 

Nope, it's all up to the programmer. Even flipping is software driven. You do not have to respect the design guidelines as these are just _guidelines_.

Link to comment
Share on other sites

if you're referring to some game being rotated 90 degrees, I think it's only a screen setup from the developer, there is no hw setting for it.

 

But the .lnx file format has an extra header added for emulators that has a byte value that can inform the emulator to preset a 90 dgree rotation (0= no totation, 1= left rotation, 2 = right rotation).

 

Obviously this is only for emulaors, but it's a clue that there isn't the same information on the cart data or there wouldn't be ny need to add it in that header.

 

 

Bingo!

 

That is what I was looking for.

 

The emulators I am using don't seem to implement it, but at least now I know it is possible.

Link to comment
Share on other sites

 

For emulation there is a bit in the lnx header telling that the game is rotated. So it is possible to emulate the Lynx correctly on a large screen. But this lnx header is not part of the cart ROM. It is for emulators only.

 

        .segment "EXEHDR"
        .byte   'L','Y','N','X'                         ; magic
        .word   __BLOCKSIZE__                           ; bank 0 page size
        .word   0                                       ; bank 1 page size
        .word   1                                       ; version number
        .asciiz "Cart name                      "       ; 32 bytes cart name
        .asciiz "Manufacturer   "                       ; 16 bytes manufacturer
        .byte   0                                       ; rotation 1=left
                                                        ; rotation 2=right

 

 

Thanks for the header definition...

 

The name/manufacturer fields are also useful...

Link to comment
Share on other sites

The implementation in most emulator is broken anyway, because of a typo ;-))

 

 

Of the ones I have been trying, they don't even *try* to implement rotated games. So you'd never get to see if there is a bug or not ;-)

 

One is based on mednafen (I think you work on that?) and the other is based on Handy.

  • Like 1
Link to comment
Share on other sites

 

 

Of the ones I have been trying, they don't even *try* to implement rotated games. So you'd never get to see if there is a bug or not ;-)

 

One is based on mednafen (I think you work on that?) and the other is based on Handy.

 

 

I'm completely guilty of that too with the online emulator I host (https://atarigamer.com/lynx/play). I probably should provide an option to rotate the canvas at some point.

Link to comment
Share on other sites

 

 

I'm completely guilty of that too with the online emulator I host (https://atarigamer.com/lynx/play). I probably should provide an option to rotate the canvas at some point.

 

 

So I guess you don't like any rotated games? ;-)

For myself, even if nobody else cared, I'd want support just so I could play Guantlet, Klax and Flappy Bird!

Link to comment
Share on other sites

Not a huge fan of them just because the console is awkward to hold. I've tried doing a simple rotation, that works fine with a bit of CSS, but then the controls get all messed up. I'm not certain how retroarch with emscripten captures keyboard events, maybe I can intercept and remap keys. Will give it a go in the next few days.

Link to comment
Share on other sites

 

 

Of the ones I have been trying, they don't even *try* to implement rotated games. So you'd never get to see if there is a bug or not ;-)

 

One is based on mednafen (I think you work on that?) and the other is based on Handy.

 

At some times zes. But I stopped because I disliked the update/commit patches policy. In Retroarch is easier to get patches and enhancements in.

The problem with emu and rotation is, that they compared the angle to 240, not 270 degree ;-)

And whoever made the lnx images, might not have noticed that the rotation flag must be either 0,90,180,270, and not 0,1

 

... and ...

 

often enough lnx files are plain rom dumps without any header (thanks to archive). So ... what do you expect? that the emulation checks each rom by hash andcomes with a embedded database? possible for lynx with teh tremendous amount of games, sure.

Edited by sage
Link to comment
Share on other sites

 

The problem with emu and rotation is, that they compared the angle to 240, not 270 degree ;-)

And whoever made the lnx images, might not have noticed that the rotation flag must be either 0,90,180,270, and not 0,1

 

... and ...

 

often enough lnx files are plain rom dumps without any header (thanks to archive). So ... what do you expect? that the emulation checks each rom by hash andcomes with a embedded database? possible for lynx with teh tremendous amount of games, sure.

 

 

Well 240 vs 270 is an easy enough fix.

 

You really have 3 states based on the v1 header -- no rotation, rotate right 90 degrees, rotate left 90 degrees. Just need to map that, and then map the controller inputs accordingly as well.

 

As to the LNX headers being incorrect...

 

Im wein ist Wahrheit... (oder Weisheit?)

 

UGH!

 

I was hoping that would not be the case.

 

We've considered writing a little command line tool to dump the headers and check them out. I guess we need to do that.

 

And if you were to do a hash and a database, is the hash on the whole file, or on the ROM portion of the file? Or both? ;-)

 

With 100-200 titles, I think that is manageable, even if you had to do it by hand.

 

I've also considered that it could be time to implement a v2 of the LNX header... Include more meta-data...

 

The other option (we are more likely to do) is to have all the meta-data in a parallel .json file and/or pull from a server database we maintain.

 

We'd like to have developer, publisher, release date, screen shots, speed-runs, etc as part of the meta-data.

 

Feel free to PM/email me if you'd like to take this offline.

Link to comment
Share on other sites

 

 

Well 240 vs 270 is an easy enough fix.

 

You really have 3 states based on the v1 header -- no rotation, rotate right 90 degrees, rotate left 90 degrees. Just need to map that, and then map the controller inputs accordingly as well.

 

As to the LNX headers being incorrect...

 

Im wein ist Wahrheit... (oder Weisheit?)

 

UGH!

 

I was hoping that would not be the case.

 

We've considered writing a little command line tool to dump the headers and check them out. I guess we need to do that.

 

And if you were to do a hash and a database, is the hash on the whole file, or on the ROM portion of the file? Or both? ;-)

 

With 100-200 titles, I think that is manageable, even if you had to do it by hand.

 

I've also considered that it could be time to implement a v2 of the LNX header... Include more meta-data...

 

The other option (we are more likely to do) is to have all the meta-data in a parallel .json file and/or pull from a server database we maintain.

 

We'd like to have developer, publisher, release date, screen shots, speed-runs, etc as part of the meta-data.

 

Feel free to PM/email me if you'd like to take this offline.

There are already documented extension ... but that doesnt mean that emulators use them consistently...

anyway it does not solve the problem, that people complain that the emulator is not detecting everything if they run a plain rom dump ;-) got enough complains already

Link to comment
Share on other sites

what do you want to fix? the emulators out there or the lnx files ;-))))))

 

You can make an MD5 hash of the ROM and then compare against saved ones to detect at least the commercial games that were using portrait mode.

So, "easy" to fix the emulators.

Link to comment
Share on other sites

 

For emulation there is a bit in the lnx header telling that the game is rotated. So it is possible to emulate the Lynx correctly on a large screen. But this lnx header is not part of the cart ROM. It is for emulators only.

 

Oh, how right you are...

 

The very first file I opened up (Gauntlet) was totally incorrect. Had no values for name, manufacture or rotation (the most important part!)

post-64463-0-18087400-1550337758_thumb.png

Link to comment
Share on other sites

Oh, in case it helps others, here is the list of rotated games I could find, and what their orientation (per header) should be:

 

 

Flappy Bird - Left

Gauntlet: The Third Encounter - Left

KLAX - Left

Lexis - Right

NFL Football - Right

Raiden - Right

Centipede - Right

Edited by bhall408
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...