re4_tweaks icon indicating copy to clipboard operation
re4_tweaks copied to clipboard

Restore Gamecube's main menu stick behavior

Open Diegoeo9 opened this issue 2 years ago • 3 comments

Describe the feature you'd like to see added

In the original gamecube version (and Wii too?), there was this little behavior to the stick, that almost no one seems to know, (since it's removed from most versions), where if you move the right stick on the village main menu, up or down would make the background zoom in or out, and move it left or right you would change the direction the background is turning, the movement was similar to when you use the sniper scope. It's a little thing, but since you are restoring Gamecube features, i would like to see it brought back. P.S. I can't find any examples of it on the internet, maybe only checking through emulator.

Diegoeo9 avatar Jul 27 '22 17:07 Diegoeo9

This is what he means:

https://youtu.be/795zZyxGXu0

Also, it would be great if the movie/trailer that plays when you wait a few seconds is active again (demo0eng.sfd and demo0.sfd) So I can remaster that video, too :P

albertre4HD avatar Jul 27 '22 17:07 albertre4HD

This is what he means:

https://youtu.be/795zZyxGXu0

Oh wow, I think I do remember this being a feature but never actually tried it out for myself. It'd be cool to see this be brought back!

linkthehylian avatar Jul 28 '22 04:07 linkthehylian

This might be handled by titleLoop function, on GC that seems to do a lot of stuff, and mentions a zoom_in_limit.1654 variable as part of it, but on the PC release it looks like most of the code was removed, just has maybe 10 lines of code that scrolls the image around instead.

emoose avatar Jul 28 '22 08:07 emoose

So this looks like it's pretty easy to restore 1:1, if I could just figure out how to hook and store the background texture ID_UNIT* ptr in titleLoop @0xC96D9B. Feels like I'm missing something obvious with my rusty C++, because I keep getting access violations.

I commented up the logic of the GC titleLoop function:

unsigned __int8 *__fastcall titleLoop(int a1)
{
  unsigned __int8 *result; // r3
  double v3; // fp0
  double v4; // fp12
  double v5; // fp13
  double v6; // fp0
  double v7; // fp0
  double v8; // fp13
  double v9; // fp12
  int back_chain; // [sp+0h] [-20h]
  char v11; // [sp+8h] [-18h]

  *(IDSystem::unitPtr(IdSys, 1, 0x28) + 0x22) = width_1653 * flt_80246BAC;// pos0_94.x = 0.0;
  *(IDSystem::unitPtr(IdSys, 2, 0x28) + 0x22) = width_1653;// pos0_94.x = 900.0;
  *(IDSystem::unitPtr(IdSys, 3, 0x28) + 0x22) = -width_1653;// pos0_94.x = -900.0;
  *(IDSystem::unitPtr(IdSys, 4, 0x28) + 0x22) = width_1653 * flt_80246BB0;// pos0_94.x = -1800.0;
  *(IDSystem::unitPtr(IdSys, 5, 0x28) + 0x22) = width_1653 + width_1653;// pos0_94.x = 1800.0;
  // ^ identical to titleLoopInit in UHD
  result = IDSystem::unitPtr(IdSys, 6, 0x28);   // the menu background texture
  if ( *(a1 + 0x40) )                           // if (a1.scroll_58) // can't zoom until you've set this TITLE_WORK flag by pressing the c-stick at least once
  {
    v11 = HIBYTE(Key);
    if ( v3 == COERCE_DOUBLE(*(&back_chain + 0xFFFFF002) >> 0x20) )// if c-stick input within deadzone?
    {
      *(result + 0x22) = *(result + 0x22) - *(a1 + 0x44);// pos0_94.x -= a1.scroll_add_5C (default value: 1.5);
    }
    else
    {
      v4 = flt_80246BB8;                        // 3.0
      v5 = ((v3 / flt_80246BB4) * flt_80246BB8);// (v3 / 59.0) * 3.0, v3 == cstickInput_x
      v6 = (*(result + 0x22) - ((v3 / flt_80246BB4) * flt_80246BB8));// pos0_94.x - (v3 / 59.0) * 3.0
      *(result + 0x22) = *(result + 0x22) - v5; // pos0_94.x -= (v3 / 59.0) * 3.0
      v11 = HIBYTE(Key);
      if ( __fabs(v6) > v4 )                    // if ((v3 / 59.0) * 3.0 < 3.0)
        *(a1 + 0x44) = v5;                      // a1.scroll_add_5C = (v3 / 59.0) * 3.0
    }
    if ( (qword_802E94E0 & 0x400000) != 0 )     // if (JOYLKAMAE)
      *(result + 0x24) = *(result + 0x24) - flt_80246BBC;// pos0_94.z -= 5.0 // zoom out
    if ( (qword_802E94E0 & 0x800000) != 0 )     // if (JOYKAMAE)
      *(result + 0x24) = *(result + 0x24) + flt_80246BBC;// pos0_94.z += 5.0 // zoom in
    v7 = *(result + 0x24);
    v8 = flt_80246BAC;                          // 0.0
    if ( v7 < flt_80246BAC )                    // if ( pos0_94.z < 0.0) pos0_94.z = 0.0;
      goto LABEL_14;
    v8 = zoom_in_limit_1654;                    // 170.0
    v9 = *(result + 0x24);
    if ( v7 > zoom_in_limit_1654 )              // if (pos0_94.z > 170.0) pos0_94.z = 170.0;
LABEL_14:
      v9 = v8;
    *(result + 0x24) = v9;
  }
  else
  {
    *(result + 0x22) = *(result + 0x22) - *(a1 + 0x44);// pos0_94.x -= a1.scroll_add_5C (default value: 1.5);
    if ( (qword_802E94E0 & 0xC000000) != 0 )    // if (CSTICK_INPUT)
      *(a1 + 0x40) = 1;                         // a1.scroll_58 = 1; // set OKAY_TO_ZOOM flag
  }
  if ( *(result + 0x22) > (width_1653 + width_1653) )// if (pos0_94.x > 1800.0)
    *(result + 0x22) = *(result + 0x22) - (width_1653 * flt_80246BB8);// pos0_94.x -= 2700.0;
  if ( *(result + 0x22) < -width_1653 )         // if (pos0_94.x < -900.0)
    *(result + 0x22) = (width_1653 * flt_80246BB8) + *(result + 0x22);// pos0_94.x += 2700.0;
  return result;
}

pas-de-2 avatar Dec 10 '22 01:12 pas-de-2