Author Topic: Dr. Mario  (Read 5689 times)

0 Members and 1 Guest are viewing this topic.

Brian Alvarez

  • Hero Member
  • *****
  • Posts: 699
    • PluriBASIC
Re: Dr. Mario
« Reply #15 on: August 04, 2019, 03:13:11 pm »
 Changing the ¤ to something more ascii-like is no problem. Maybe i will do that for the sake of clarity.

 By the way Charles, how dos this run in your PC?

Mike Lobanovsky

  • Hero Member
  • *****
  • Posts: 1993
Re: Dr. Mario
« Reply #16 on: August 04, 2019, 03:36:35 pm »
OK Brian,

The PB version performs quite nicely. It dumps initially SFX20.mp3 and then, as the game goes, it also dumps SFX21 to SFX24, pause, and resume music. If all those resources are present, the O2 version performs flawlessly as well.

Unfortunately, not so if there are no resources dumped yet. Then O2 would crash as shown in the topmost snapshot below. Or, if there are only some (but not all!) resources available, it would crash whenever it is supposed to dump a resource of its own. ???  (see the bottom-most snapshot below)

So, the offending code probably resides somewhere in the resource dumping procedures.

I was playing with your precompiled binaries and didn't try to compile my own yet. I will also try them under my Windows 10 a while later and will report back as soon as ready.

But overall, the game is rather entertaining. Thank you very much for this contribution to our code base!
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Mike Lobanovsky

  • Hero Member
  • *****
  • Posts: 1993
Re: Dr. Mario
« Reply #17 on: August 04, 2019, 04:01:27 pm »
Everything seems to run perfectly fine on my Windows 10 box though the defender does take a few seconds to scan the O2 binary for threats even though the zip has been properly unblocked beforehand.

In both cases (W7 and W10), the folders were DL'ed and extracted directly on my desktops, and the binaries were run from there too, if this info may matter in any way.
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Brian Alvarez

  • Hero Member
  • *****
  • Posts: 699
    • PluriBASIC
Re: Dr. Mario
« Reply #18 on: August 04, 2019, 04:41:44 pm »
 Thank you Mike! this gives me more clues! I will have it fixed tonight.

 I will also correct the typo on Excercise.  :o  Too many words in my head, I mix languages sometimes. :)

 I believe this is the culprit:

Code: [Select]
    ' This part checks if the file exists, if it doesnt, it extracts it from resource.
    IF isfalse(len(dir$(resname & ".mp3"))) then
        FF = FREEFILE
        errclear
        OPEN resname & ".mp3" for binary as #ff
            Cont = resource$(rcdata, resname)
            errclear
            PUT #FF,,Cont
            seteof #ff
        CLOSE #FF
    end if

 Which is converted to oxygen like this:

Code: [Select]
   IF ¤ISFALSE(LEN(¤DIR(resname & ".mp3", byval 0, byval 0))) THEN
      ff = (FREEFILE())
      ERRCLEAR
      ¤OPENFILENM(resname & ".mp3", 4, 0, 0, ff, 128, 1, 1, Err)
      cont = (¤RESOURCE("data", resname))
      ERRCLEAR
      ¤PUTSTR(string, ff, -1, cont, 0, 0, 0)
      SETEOF(ff)
      CLOSE(ff, Err)
   END IF

Brian Alvarez

  • Hero Member
  • *****
  • Posts: 699
    • PluriBASIC
Re: Dr. Mario
« Reply #19 on: August 04, 2019, 08:44:54 pm »
The new code "drmario.o2bas" has error checking to make sure it is able to extract files.

 It will try to extract the intro mp3 even if it exists. If the game proceeds, then it assumes
it can extract files. If it crashes, it will probably have something to do with the extraction
or the saving procedure.

 I have also extracted the source code, it is still 32bits. The resources remain the same.

Note: just a couple minutes after uploading the executables, I tested the downloaded executables
and they crash. The originals here are not crashing, but the downloaded ones are crashing. I will
make some tests to see if the location of the executable is causing this, or it is the executable that is
different.

Note 2: Gah, that didnt take long. The freshly compiled executables here work perfectly fine, but the downloaded
ones are crashing. I dont know what is corrupting them.

 For now, the safest option will be to make a fresh compile and link resources locally.

 If someone can recompile, upload to github and confirm that the fresh executable works fine, while the
ones downloaded from github (or some othe place) crashes, Please do.

 It might give a hint that something is wrong with the executable (since the PowerBASIC one does not
present this issue).

Arnold

  • Hero Member
  • *****
  • Posts: 977
Re: Dr. Mario
« Reply #20 on: August 05, 2019, 03:17:51 am »
Hi Brian,

after extracting your latest DrMario-Exercise-master.zip into a fresh folder, I can confirm that ox32_drmario.exe, ox64-drmario.exe and PowerBasic_drmario.exe run well with my system, with or without the initial created mp3 files. I can also compile, link and start drmario.exe as a 32-bit application. But the 64-bit exe will only load sfx21.mp3 but the window will not open and I have to kill the app with the task-manager.

I am still curious what is different with your 64-bit exe. With me function DialogNew returns a result of 0. Did you apply GetWindowLongPtr / SetWindowLongPtr for the 64-bit app?

Roland


Charles Pegge

  • Admin Support Member
  • *****
  • Posts: 4486
    • Oxygen Basic
Re: Dr. Mario
« Reply #21 on: August 05, 2019, 05:03:08 am »
Brian,

All binaries working on my Windows10 system. 32bit o2 compilation also okay, but I see many dword handles in the script, preventing 64bit operation.

Mike Lobanovsky

  • Hero Member
  • *****
  • Posts: 1993
Re: Dr. Mario
« Reply #22 on: August 05, 2019, 08:46:32 am »
Gentlemen,

It is now more or less clear that everything is, or eventually will be, all right with both 32- and 64-bit compilation under Windows 10. So let's leave it aside for the moment. Our immediate concern is not Win10 or 64 bits!

Our most urgent concern is that, under Win7, even 32-bit OxygenBasic user binary doesn't work properly if it is downloaded from the net!

Is there at least one more user here who's got a decent Win7 installation rather than those kiddie's-first-gadget Win10 laptops? If yes, then please confirm or disprove that Brian's 32-bit game exe crashes under Win7 if downloaded from the GitHub repo rather than compiled by you!


And Brian, please make sure and confirm that you have

i) unblocked properly your zip downloaded from the repo;
ii) disabled your Defender real-time monitoring; and
iii) disabled your other AV SW (if any)

before you launch your 32-bit game exe only to see it crash under your Win7 again and again. I hereby confirm that under my Win7, the game keeps crashing even if I take all the three above-mentioned precautions.


(On a side note, I've always said that I don't like a careless and brute-force approach to the resources with this primitive LinkRes2Exe app. If the app author(s) is/are on such close terms with its code then please make LinkRes2Exe also recalculate and write a correct checksum into the binary's PE header once the .RES file is "linked" in it. And the users who generate .RES files for their executables with 3rd party SW, please make sure your .RC and .RES files have

-- an app icon,
-- a version resource,
-- and an appropriate manifest resource defined and precompiled in them.

James has a nice universal manifest file he uses for compiling his executables with indie C compilers like e.g. TinyC Compiler/TCC. I'm sure it can be used successfully for O2 user binaries as well. The version resource syntax isn't overcomplicated either. So why not make it a habit to compile and test sterling Windows-compliant executables that won't be randomly f@#$ed up by AVs of all sorts?

For all I care GitHub may have its own anti-virus service which screws the exes that people upload there... ::))
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Brian Alvarez

  • Hero Member
  • *****
  • Posts: 699
    • PluriBASIC
Re: Dr. Mario
« Reply #23 on: August 05, 2019, 10:30:32 am »
 No matter what i do, the downloaded ones always crash (including Mike's 3 steps).
 No matter what i do, the locally compiled ones always work fine (including different locations).

 I have already implemented this functionality:

Code: [Select]
#RESOURCE Manifest, 1, "winxp.xml"
 I have a couple universal manifests here that i can try with, I will report back my results, however
the PowerBASIC ones do not have a manifest either, and it works fine here when downloaded
from GitHub, so, my expectations are low for this approach.

 I also think that something in GitHub is causing this. That is my best guess right now.

 There must be something it doesnt like about Oxygen's executables. Other tools like ILMerge.exe do not work
on Oxygen's executables either. PECompact.exe works with them though.

Brian Alvarez

  • Hero Member
  • *****
  • Posts: 699
    • PluriBASIC
Re: Dr. Mario
« Reply #24 on: August 05, 2019, 11:00:57 am »
 How about that... with the manifest, it doesnt crash anymore (ox32_drmario.exe)...  ;D

Correction.... it crashes less.
« Last Edit: August 05, 2019, 01:17:40 pm by Brian Alvarez »

Aurel

  • Guest
Re: Dr. Mario
« Reply #25 on: August 05, 2019, 11:07:54 am »
Quote
Is there at least one more user here who's got a decent Win7

I have of course win7 32bit.

But i must to know what exactly i need to download ?

'---------------------------------------------------------------------------------
Do i must download oxygenbasicprogress.zip
'-----------------------------------------------------------------------------
You know me ,i don't like to use untested versions,i still use 043
which work fine for me,if i stuck in something i know where to look.

by the way i am using Kaspersky  which never complain about any o2 exe  :)
« Last Edit: August 05, 2019, 11:18:19 am by Aurel »

Mike Lobanovsky

  • Hero Member
  • *****
  • Posts: 1993
Re: Dr. Mario
« Reply #26 on: August 05, 2019, 04:22:59 pm »
Hi Aurel,

Please go to this message. It contains a link to Brian's GitHub repository. Follow the link and download the zip with his code.

Unblock the zip by right-clicking on the file and then extract drmario.exe from it. That's a 32-bit O2 executable of Brian's game. Please launch it and tell us if it crashes for you or not.

TIA
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Mike Lobanovsky

  • Hero Member
  • *****
  • Posts: 1993
Re: Dr. Mario
« Reply #27 on: August 05, 2019, 04:44:14 pm »
Hi Brian,

James' manifest file comes in this message of his.

I would only suggest changing his processorArchitecture="amd64" (fifth line from the top) that makes it valid only for 64-bit executables to processorArchitecture="*" that will make it "universal" for both 32 and 64 bits. It's compatible with every Windows OS from Vista up to W10.

But the manifest alone won't work against duller AVs. The exes must also contain a valid version resource, and the locale of other resources (images, audio, etc) precompiled in the exe must also correspond to the locale set forth in the version resource.

All those measures are a prerequisite that some day VirusTotal will stop flagging O2 executables with false positives.

Re. the PB exe, PowerBASIC is historically too well-known to public at large for the AV writers to fiddle with and get away with it. I am almost sure more than one of them suffered losses from the late Bob Zale for what they have been doing to indie developers. ;)
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Brian Alvarez

  • Hero Member
  • *****
  • Posts: 699
    • PluriBASIC
Re: Dr. Mario
« Reply #28 on: August 05, 2019, 04:47:24 pm »
Ok, im trying...

Brian Alvarez

  • Hero Member
  • *****
  • Posts: 699
    • PluriBASIC
Re: Dr. Mario
« Reply #29 on: August 05, 2019, 05:14:35 pm »
I have re uploaded ox32_drmario.exe and also updated the RES file.

 The locale for the resources is the same as the version info.