Author Topic: plus.isDebugMode()  (Read 2324 times)

Online apanx

plus.isDebugMode()
« on: September 29, 2016, 10:18:31 AM »
So, when is it true?

Offline Trovaner

  • *
  • Posts: 1222
  • Rep: 32
    • View Profile
    • Awards
Re: plus.isDebugMode()
« Reply #1 on: October 02, 2016, 02:20:04 PM »
I'm pretty sure it is always false. The devs probably have a boolean in the EXE that they manually set during development. You may be able to enable it using sergepatcher. I usually just create my own boolean for turning on the debug code.

Offline Badger

  • Permanent Artifact
  • Giga Heavyweight
  • Posts: 6318
  • Rep: 3
  • I wish to be with my people
  • Awards BOTM Winner Donated money for site hosting 2019
    • View Profile
    • Awards
Re: plus.isDebugMode()
« Reply #2 on: October 02, 2016, 03:36:53 PM »
well there goes trov's quarterly post.
also lol at most toxic guy around calling others out on this sh**
Google Drive with my newer bots

Offline Serge

  • *
  • Posts: 1530
  • Rep: 13
    • View Profile
    • http://www.q3k.org/
    • Awards
Re: plus.isDebugMode()
« Reply #3 on: October 06, 2016, 09:15:49 PM »
So, when is it true?

Never. It will always return None.

Code: [Select]
.text:004BC585                 push    offset aIsdebugmode ; "isDebugMode"
.text:004BC58A                 push    offset py_isDebugMode
.text:004BC58F                 mov     ecx, esi
.text:004BC591                 call    sub_4BDF80

[...]

.text:004B9BF0 py_isDebugMode  proc near               ; CODE XREF: sub_57C000+9Cp
.text:004B9BF0                                         ; DATA XREF: sub_4BBA00+B8Ao ...
.text:004B9BF0                 xor     al, al
.text:004B9BF2                 retn
.text:004B9BF2 py_isDebugMode  endp
home | twitter | yt | gmf de/compiler | component freedom | xmpp: q3k@q3k.org | email: q3k@q3k.org

Online apanx

Re: plus.isDebugMode()
« Reply #4 on: October 10, 2016, 01:43:53 PM »
Thanks Serge

Patched it statically to
Code: [Select]
.text:004B9BF0                 or     al, alNow it returns true

Big meh, just crashes the game when trying to play. I suppose it needs extra coding from debug-build to work properly.
https://gametechmods.com/forums/index.php?action=downloads;sa=view;down=288

OffTopic: Also patched in 16-point chassis limit removal statically based on offsets in SergePatcher, can put it up on GTM for you.

Offline Serge

  • *
  • Posts: 1530
  • Rep: 13
    • View Profile
    • http://www.q3k.org/
    • Awards
Re: plus.isDebugMode()
« Reply #5 on: October 11, 2016, 02:26:40 PM »
Thanks Serge

Patched it statically to
Code: [Select]
.text:004B9BF0                 or     al, alNow it returns true

Big meh, just crashes the game when trying to play. I suppose it needs extra coding from debug-build to work properly.
https://gametechmods.com/forums/index.php?action=downloads;sa=view;down=288

OffTopic: Also patched in 16-point chassis limit removal statically based on offsets in SergePatcher, can put it up on GTM for you.

The reason it doesn't work is because this function returns a PyObject *, so it should return the global Py_True or another truthy object. Returning a C NULL for None only works because of the way the C API parses a NULL that way. Everything else (including an 0x00000001-FF) will get parsed as a PyObject*, so in the case of an invalid pointer (like 0x1) will crash on dereferencing.
home | twitter | yt | gmf de/compiler | component freedom | xmpp: q3k@q3k.org | email: q3k@q3k.org