It is currently Tue Oct 24, 2017 4:37 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 33 posts ]  Go to page 1, 2, 3  Next
Author Message
PostPosted: Fri Jun 17, 2016 7:10 am 
Offline
User avatar

Joined: Mon Dec 29, 2014 1:46 pm
Posts: 713
Location: New York, NY
I am attempting to add VS. Zapper support to my emulator by following the description on the wiki (the VS. Zapper is strobed and serialized like a standard controller). But, it is only partially working. In VS. Duck Hunt, when the trigger is pulled on the single player select screen, it generates a fully black frame, then a fully white frame and finally another fully black screen. Debugging reveals that during the black frames, it reads from the controller port once per scanline, presumably examining the light sensor bit. However, during the white frame, it does not read from the controller port at all. Debugging also shows that during the white frame, the light sensor is active for 26 scanlines. But, since the game is simply not reading from the controller port during the white frame, it fails to get detected.

I tried various combinations of trigger pull times and light sensor active times without success.

Could this somehow be related to the VS. palettes? VS. Duck Hunt uses a palette that is almost identical to the standard NES palette. However, is something strange done to generate the fully colored frames? Could the black and white frames be reversed in color or something?


Last edited by zeroone on Tue Jun 28, 2016 5:54 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Sat Jun 18, 2016 6:57 am 
Offline
User avatar

Joined: Sun Sep 19, 2004 10:59 pm
Posts: 1390
The Vs Zapper's light sense bit is inverted compared to the standard Zapper (or "normal" from a neutral standpoint) - 1 when sensing light, 0 otherwise. If you were using the same behavior as the normal Zapper, the game probably decided that you weren't pointing at the screen and thus didn't bother checking it during the white frame (though it would've also stopped reading during the "dark" frame after the very first scanline).

_________________
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.


Top
 Profile  
 
PostPosted: Sat Jun 18, 2016 8:41 pm 
Offline
User avatar

Joined: Mon Dec 29, 2014 1:46 pm
Posts: 713
Location: New York, NY
Quietust wrote:
The Vs Zapper's light sense bit is inverted compared to the standard Zapper (or "normal" from a neutral standpoint) - 1 when sensing light, 0 otherwise. If you were using the same behavior as the normal Zapper, the game probably decided that you weren't pointing at the screen and thus didn't bother checking it during the white frame (though it would've also stopped reading during the "dark" frame after the very first scanline).


Thanks for the suggestion, but my implementation is already doing that per the information on the wiki. The cause of the issue is something else.


Top
 Profile  
 
PostPosted: Sun Jun 19, 2016 1:00 am 
Offline
Site Admin
User avatar

Joined: Mon Sep 20, 2004 6:04 am
Posts: 3473
Location: Indianapolis
I don't know how it's detected exactly, but the gun manual for the VS says that games are supposed to trigger an alarm if it thinks the gun has been removed/stolen/vandalized. Maybe the game thinks something is wrong and is getting into a state where it doesn't check for hits anymore? Just a guess. I would think you'd hear an audible alarm if that was the case, but I don't know, it must depend on how each game handles it.


Top
 Profile  
 
PostPosted: Sun Jun 19, 2016 6:26 am 
Offline
User avatar

Joined: Sun Sep 19, 2004 10:59 pm
Posts: 1390
Memblers wrote:
I don't know how it's detected exactly, but the gun manual for the VS says that games are supposed to trigger an alarm if it thinks the gun has been removed/stolen/vandalized. Maybe the game thinks something is wrong and is getting into a state where it doesn't check for hits anymore? Just a guess. I would think you'd hear an audible alarm if that was the case, but I don't know, it must depend on how each game handles it.

You definitely do hear an alarm in Duck Hunt when that happens - if the gun isn't connected on startup, it plays about 2 notes of the title screen tune before emitting a loud beep, and disconnecting it at any point during gameplay has a similar effect. Hogan's Alley is the same way.

_________________
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.


Top
 Profile  
 
PostPosted: Tue Jun 21, 2016 11:15 am 
Offline
User avatar

Joined: Mon Dec 29, 2014 1:46 pm
Posts: 713
Location: New York, NY
@Quietust Is there any way to test the VS. Zapper in Nintendulator? It reports Mapper 099 as unsupported, but source suggests otherwise.


Top
 Profile  
 
PostPosted: Wed Jun 22, 2016 7:58 am 
Offline
User avatar

Joined: Mon Dec 29, 2014 1:46 pm
Posts: 713
Location: New York, NY
I really can't figure out what is going wrong with my VS. Zapper implementation. I'm willing to run whatever test anyone can suggestion. I'm out of ideas. Thanks.


Top
 Profile  
 
PostPosted: Thu Jun 23, 2016 4:41 am 
Offline
User avatar

Joined: Sun Sep 19, 2004 10:59 pm
Posts: 1390
zeroone wrote:
@Quietust Is there any way to test the VS. Zapper in Nintendulator? It reports Mapper 099 as unsupported, but source suggests otherwise.

Either you're running a very old version (0.975, despite being "unstable", is what you actually want to be running), or you somehow extracted the archive without subfolders and it can't find the mapper DLLs.

_________________
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.


Top
 Profile  
 
PostPosted: Thu Jun 23, 2016 5:18 am 
Offline
User avatar

Joined: Fri Nov 19, 2004 7:35 pm
Posts: 3944
Or maybe the mapper DLLs got overwritten with DLLs from another emulator. I know that NESten uses the same filenames for mappers.

_________________
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!


Top
 Profile  
 
PostPosted: Thu Jun 23, 2016 7:02 am 
Offline
User avatar

Joined: Mon Dec 29, 2014 1:46 pm
Posts: 713
Location: New York, NY
Quietust wrote:
zeroone wrote:
@Quietust Is there any way to test the VS. Zapper in Nintendulator? It reports Mapper 099 as unsupported, but source suggests otherwise.

Either you're running a very old version (0.975, despite being "unstable", is what you actually want to be running), or you somehow extracted the archive without subfolders and it can't find the mapper DLLs.


Version 0.975 does not appear to support Mapper 099. I re-downloaded it to be sure. I see the VS.dll in the the mappers subdirectory. It is dated 02/28/2015.

By the way, what controller does VS Duck Hunt expect in the other port?


Top
 Profile  
 
PostPosted: Thu Jun 23, 2016 12:19 pm 
Offline

Joined: Tue Aug 07, 2007 10:28 am
Posts: 95
What is your zapper implementation?

Do you have it assigned to the correct port?


Top
 Profile  
 
PostPosted: Thu Jun 23, 2016 12:32 pm 
Offline
User avatar

Joined: Mon Dec 29, 2014 1:46 pm
Posts: 713
Location: New York, NY
2600 wrote:
What is your zapper implementation?

Do you have it assigned to the correct port?


I followed the description on the wiki. It provides the data serially like the gamepad. My VS Zapper implementation is an extension of my standard NES Zapper implementation that works correctly with normal Duck Hunt. In VS Duck Hunt, the player select screen flashes when the trigger is pulled, but the game fails to register the hit. Per the description earlier in the thread, the flash is actually 3 frames: full black, full white, full black. Debugging shows that it reads from the zapper port once-per-scanline only during the full black frame, ignoring when the light sensor detects the white frame. The sensor is also inactive in the black frame.

Since the trigger and the light sensor data is delivered serially from the same bit and the game does respond to the trigger, it suggests that my implementation is rigged up to deliver the data on the proper port.

I'm willing to run any experiment and collect any kind of logging that someone can suggest. This is a really strange issue.


Top
 Profile  
 
PostPosted: Thu Jun 23, 2016 3:51 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 10:59 pm
Posts: 1390
zeroone wrote:
Version 0.975 does not appear to support Mapper 099. I re-downloaded it to be sure. I see the VS.dll in the the mappers subdirectory. It is dated 02/28/2015.


Open the ROM in Nintendulator's Header Editor and make sure the "VS Unisystem" flag is set. If it's not set, that's why it doesn't work - VS.dll will only accept .NES files that have that flag set.

_________________
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.


Top
 Profile  
 
PostPosted: Thu Jun 23, 2016 4:24 pm 
Offline
User avatar

Joined: Mon Dec 29, 2014 1:46 pm
Posts: 713
Location: New York, NY
Quietust wrote:
Open the ROM in Nintendulator's Header Editor and make sure the "VS Unisystem" flag is set. If it's not set, that's why it doesn't work - VS.dll will only accept .NES files that have that flag set.


Thanks. Setting the flag in the header enabled it to load. Nintendulator's VS UniSystem Zapper works perfectly.


Top
 Profile  
 
PostPosted: Thu Jun 23, 2016 7:55 pm 
Offline
User avatar

Joined: Mon Dec 29, 2014 1:46 pm
Posts: 713
Location: New York, NY
@Quietust In the controller port write function below, does PPU::DrawArray contain prior frame pixel values within the region that has yet to be updated? Or, is PPU::DrawArray cleared between frames?

Code:
void   StdPort_VSZapper::Write (unsigned char Val)
{
   int x = State->PosX, y = State->PosY;

   State->Strobe = Val & 1;
   if (!State->Strobe)
      return;
      
   State->Bits = 0x10;
   State->BitPtr = 0;
   if (State->Button)
      State->Bits |= 0x80;

   if ((x < 0) || (x >= 256) || (y < 0) || (y >= 240))
      return;

   if (PPU::IsRendering && PPU::OnScreen)
   {
      int X, Y;
      int WhiteCount = 0;
      for (Y = y - 8; Y < y + 8; Y++)
      {
         if (Y < 0)
            Y = 0;
         if (Y < PPU::SLnum - 32)
            continue;
         if (Y > PPU::SLnum)
            break;
         for (X = x - 8; X < x + 8; X++)
         {
            if (X < 0)
               X = 0;
            if (X > 255)
               break;
            if ((Y == PPU::SLnum) && (X >= PPU::Clockticks))
               break;
            if (GFX::ZapperHit(PPU::DrawArray[Y * 256 + X]))
               WhiteCount++;
         }
      }
      if (WhiteCount >= 64)
         State->Bits |= 0x40;
   }
}


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 33 posts ]  Go to page 1, 2, 3  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group