SukkoPera / SMSPlusPlus

Pause-from-pad, IGR and 50/60 Hz mod for Sega Master System
14 stars 6 forks source link

Use on GameGear #4

Open Xenogears75 opened 5 years ago

Xenogears75 commented 5 years ago

I´d like to use your Code for GameGear. The "TH" is missing on the GG-Asic, due to there is nothing to Plug inside usually. Is there a way to make a workaround or recode a little without mutch work? In Fact, only the Start-Button OUTPUT would be needed as Active Low.

SukkoPera commented 5 years ago

I'm sorry but I don't really know how the Game Gear works and really have no time to look into that right now.

I'm leaving this open and marking it help-wanted in case anybody wants to help with that.

Xenogears75 commented 5 years ago

First Things first, I start with measuring out how the Adurino Pro Mini Code works inside a Master System. Controls are similar, same Signal but the GG has not the "TH" Signal. I keep on Testing and let everyone know here. Thanks for your great Coding !

SukkoPera commented 5 years ago

I had a quick skim through the code and I think you can just ignore the TH signal from the Arduino to the console, it shouldn't hurt.

Xenogears75 commented 5 years ago

Yes, thats also what I thought. Direction Buttons and TR/TL work finde but Start seems to have a Malfunction. If I press it, nothing happens for a while, the Pause Output has no State according to my Logic Probe. Then, after a non specific time, it works but has a Pulse. Like Autofire. If I change

// Duration of the reset/pause pulse (milliseconds)

define PULSE_LEN 250

the PULSE_LEN e.g. to 50, it pulses faster, like Slowmotion on old Controllers. If I could get this to work, I could write a Installations Guide how to use your fine work in Game Gears. I bought some new Nano as I´d like to be certain, the issue is not caused by the Pro Mini Board... THANKS FOR YOUR TIME !!

SukkoPera commented 5 years ago

The Pause output is a pulse by design, what's wrong with this?

Xenogears75 commented 5 years ago

The Pause-Function of the Sega Master System Console is not a pulsing Signal. Its just an on/off Signal. The Pause-Line has a Pull-Up-Resistor, if the PAUSE-BUTTON on the Console is pressed / tipped on shortly, it becomes Low and Pauses. A Second Press and the Unit unpauses as you certainly know.

So first, when you PowerOn the Console, the START-Button of the MD 3 / 6 Controller has no function. After a random time period, it starts to work but not suitable as Pause-Function: If you press the Button, the Console gets into Pause-Mode. If you press again, nothing happens until the PULSE_LEN Time is run out and you could press again to Unpause the Console. A simple "Press START to PAUSE/UNPAUSE" would be perfect. Unfortunately my Programming Abilities are those of a Rookie. I will try to understand your work tonight and maybe could manage to

  1. Deactivate the Pause Pulsing
  2. to use the START-Button on MD3/6 Pad like a normal Firebutton to Pause / Unpause

If one would like to Reset the Unit, your Button-Combo would certainly do fine. It´s just PAUSE by START that needs to be optimized. And again - Thank you very mutch for Reading - I know the Value of Time (especially Sparetime if you have some ;-) )

SukkoPera commented 5 years ago

Well, when you're pressing a button and releasing it after a bit, you're creating a pulse, so I don't really see the difference.

Currently it's an active low pulse, which means the line is normally high and will go low for a bit, is this how it works on the GG as well?

Do you know if there's a pull-up resistor on the pause signal?

Xenogears75 commented 5 years ago

Yes, the START/PAUSE Button on GameGear is Active High, a Press connects it to GND, sets it low and executes the Signal. Similar to the Pause on Master System but according to Special GameGear Games it is also designed to just start the Game.

I have installed your Code inside a Master System for Testing and the Issue is only regarding the START / PAUSE Function by Controller: I start the Game. TL and TR and also the D-Pad work flawless. If I press "C" on the MD-Controller, one of the Adurino LED turns off. If I press and hold A when turning on the Unit, the Change from B+C to A+B as Buttons works flawless.

BUT: If I press START on the (original) MD-Controller, nothing happens on D4 / Pause out. After a unspecific while, I could press START on the MD-Controller and the System pauses. If I press again, nothing happens, unless I wait about 2 Seconds before Start is recognized again. From here on, I could Start/Pause by pressing the Controller START-Button with about 2 Seconds Delay between Presses.

Xenogears75 commented 5 years ago

"Well, when you're pressing a button and releasing it after a bit, you're creating a pulse, so I don't really see the difference." - Exactly. The Difference between TR/TL and START is:

Press TR/TL and the Output becomes Low as long as the Button is pressed Press START and the Outputline becomes Low for PULSE_LEN 250, the it´s pulled High Again by Pullup-Resistor. But you cannot Press again until the Pulse-Time is over.

After very intense Testing, there is also one more Thing that seems not to work as it should: If I Press the TL or TR rapid manually, on the Output-Side a lot of Button Presses are lost. E.g. If I Press 10xFast on the Input Side, only between 4-6 Presses are put Out. This is a Problem for Shoot em Ups or Similar.

AS I CANNOT GUARANTEE I MIGHT HAVE A FAULTY ADURINO 328P; I will go on when I got new ones...

Xenogears75 commented 5 years ago

...today the original Adurino NANO (the ones with USB-Mini-Connector) arrived. I first tested the original code. Perfect. Every function works as described. So forget all the Issues I mentioned before. The Code somehow does not work on my Arduino pro mini / 328p +5V 16 Mz. Next Step: Plant into the GG !

SukkoPera commented 5 years ago

That's great to hear! Let me know how it works on the GG!

Xenogears75 commented 5 years ago

…it works perfect. I connected the Outputs over a Diode to the 4 +3 Pad, to the Side that is active high when nothing is pressed. So everything seems to work. The Diodes avoid a Short Circuit in Case Buttons on the GG and the Pad are pressed at the same time…

SukkoPera commented 5 years ago

Well, this is just great! Would you make some kind of tutorial and/or provide some pictures to help anybody else who might be interested?

Xenogears75 commented 5 years ago

…yes, I will make a Picture of my Installation and also try to create a schematic… I also changed the Autofire-Speed, multiplied by 2 – exzellent for Shmups !

Xenogears75 commented 5 years ago

By the way: instead of Toggle 50/60 Hz you could use this feature to change GG-Region. Important, as some Games have different Graphics on Title-Screen or even

a whole Level more, e.G. RiStar ;-) and if you´ d like to play FM-Audio Games, you need the right Region Setting for Games like Wonderboy Monsterword III

SukkoPera commented 5 years ago

As stated above, I know nothing about the GG, so we're in your hands :).

Xenogears75 commented 5 years ago

…figured out, the GG-Screen looes Brightness, when I use the Original D-Pad on the System. So I put 10KOhm Resistors in Line : Fixed !

If there is an Easy way to change Outputs from Active low to Active High, your Mod would also work on Atari Lynx / VCS….

Xenogears75 commented 5 years ago

Update: Changed Outputs for Direction + TL / TR to HIGH, Outputs now act ActiveHIGH, so that the Code works perfect inside Atari Lynx. You have to connect each Output over 10kOhm Resistor in Line ! Whats not working is pressing START. Any Idea how to Change Output D4 so that it gives an Active HIGH Signal, when Start on the MD-Joypads is pressed ?

P.S.: Tutorials will follow, as soon, as I am Ready with both Units !!

SukkoPera commented 5 years ago

Remove lines 1135-1137.

Add this:

if (pad_status & MD_BTN_START) {
  digitalWrite (PAUSE_OUT_PIN, HIGH);
} else {
  digitalWrite (PAUSE_OUT_PIN, LOW);
}

after the following lines:

            // Send pad status to SMS
            byte smsPad = mdPadToSms (pad_status);
            write_sms_pad (smsPad);

Swap HIGH and LOW if you want to make it active-low.

Also add this under setup():

pinMode (PAUSE_OUT_PIN, OUTPUT);