Author Topic: Goal for 2018  (Read 897 times)

0 Members and 1 Guest are viewing this topic.

Offline RadeonUser

  • PJ64 Dever
  • Full Member
  • *****
  • Posts: 202
  • Karma: +1/-0
  • SuperFly Deving Guy
Goal for 2018
« on: January 01, 2018, 09:15:03 PM »
Hey everyone!

Just leaving a message here to let everyone know what I plan to do this coming year (Likely 3-4 months but hopefully less!)
I've been going through the code trying to make it less crash-prone for plugins like Icepir8's and have been finding code that isn't acceptable.

So I am going into code-review mode and will try to fix up things I notice are wrong.
This doesn't mean I won't look at posts or put out small fixes here and there but it means the majority of my energy will be going into reading, understanding, and replacing code as needed.
This may be as simple as making very similar code into a function (There's a lot of code copied and pasted around) or may involve more of an overhaul than I want to do.

The end-goal? Stability.
It is my vision to have PJ64 never crash to desktop.
If it ever runs into a problem (It can't be helped after all!) it should fall back into a stable state (The rom browser for example) without losing everything.

I will periodically add to this thread when I have time or have actually accomplished something.

Offline RadeonUser

  • PJ64 Dever
  • Full Member
  • *****
  • Posts: 202
  • Karma: +1/-0
  • SuperFly Deving Guy
Re: Goal for 2018
« Reply #1 on: March 07, 2018, 08:15:49 AM »
I think I'm going to have to redo the settings as a whole very soon.
I've been trying to keep old behavior as much as possible to prevent problems but this in itself is revealing issues with the coding style.

So I'll have to rewrite quite a bit of the settings code for it to play nice.
I may just buckle down and take the easy route of doing things in C++

That's not to say it can't be done in C, it's just that a lot of this is already done for me in higher level languages.
C# would be a dream for example  ;;)
The only potential issue is that C is a lot faster in terms of file i/o
Now, if I were using a newer compiler that'd be less of an issue but we're sticking to VS2010 for the foreseeable future.

So Gent -- Catalog but stow any issues you're having with the files (Cheats, etc...)
I'm in it for the long haul it seems.

Offline RadeonUser

  • PJ64 Dever
  • Full Member
  • *****
  • Posts: 202
  • Karma: +1/-0
  • SuperFly Deving Guy
Re: Goal for 2018
« Reply #2 on: March 09, 2018, 03:04:47 PM »
One of the first things that bears fruit from a deeper understanding.

OpenGL plugins should no longer crash (At least on start emulation/end emulation).
Sadly I've not yet had time to work on settings so you'll see crashes from that (It's cheat related, you might be able to suppress them by turning on Remember Cheats)

I've not looked to see if this would fix state loads, resolution changes, etc... yet.
Gent that's for you to test  :-bd

Edit: Added a timeout and a message for when the emulation thread has to be force closed on End Emulation.
For those times when the emulation thread is unresponsive due to plugins or emulation issues.
 
« Last Edit: March 09, 2018, 03:55:48 PM by RadeonUser »

Offline Gent

  • PJ64 Dever
  • Sr. Member
  • *****
  • Posts: 448
  • Karma: +2/-0
  • SuperFly Deving Guy
    • Project64 Website
Re: Goal for 2018
« Reply #3 on: March 09, 2018, 04:58:33 PM »
Ok last few build have had this Failed to save settings nightmare.

So i have done a quick video showing how once you get it, terminal fek over.


Offline Gent

  • PJ64 Dever
  • Sr. Member
  • *****
  • Posts: 448
  • Karma: +2/-0
  • SuperFly Deving Guy
    • Project64 Website
Re: Goal for 2018
« Reply #4 on: March 09, 2018, 05:05:32 PM »
Even quicker route is to try to use cheats via cheat menu


Offline RadeonUser

  • PJ64 Dever
  • Full Member
  • *****
  • Posts: 202
  • Karma: +1/-0
  • SuperFly Deving Guy
Re: Goal for 2018
« Reply #5 on: March 13, 2018, 05:32:24 AM »
There were some logic snafus from my part, however while it is better it is not usable quite yet.

The problem I'm running into is that I didn't anticipate the nature of 1.6's cheat implementation.
I truly hope this has been changed in the later versions of PJ64.

1.6 uses the registry to act as a hold/store/general go to for just about anything cheats.
Project64 has two threads, the main thread (The window), and the emulation thread (Where the game runs).
Both access the same area pretty much simultaneously, thankfully accessing the registry is thread safe.
What I created isn't thread safe whatsoever so there's problems opening the file while a write is happening.

So there's two ways I can fix this.
1) Make the thread(s) yield if the file is already in use
2) Redo the logic so reads and writes are only performed by the main thread (Start Emulation and End Emulation for example).

Number 2 will come with the possible benefit of increasing the maximum number of cheats that can be applied.
Why's that? Because accessing the registry as many times as 1.6 was is costly.
This is where I believe Gent came up with the limit of 500 cheats and 100 GS cheats (I'll be honest I don't know the difference, thankfully I don't have to, we have Gent).

So I will be doing my best to come up with a solution that is not bogged down by constant file reads and writes (registry included, because even if it's cached by the operating system this is still costly)

This isn't the only place where I need to make changes either.
Changing the size of the window, moving it around, etc... is all written to file/registry as it occurs.
I won't go into how much this makes my head hurt -- Honestly, you don't need to know!

So this is my current project, STILL working on the settings overhaul!
Gent - Kill me now  :'(

Offline RadeonUser

  • PJ64 Dever
  • Full Member
  • *****
  • Posts: 202
  • Karma: +1/-0
  • SuperFly Deving Guy
Re: Goal for 2018
« Reply #6 on: March 15, 2018, 02:29:55 AM »
Well, a deeper look at cheats reveals I misunderstood how they work.
That was a good thing since I was dreading the nightmare.

So yes I made some assumptions, dreaded the worst, and found out the world isn't quite as bleak as I thought it was.
 <:-P

Offline RadeonUser

  • PJ64 Dever
  • Full Member
  • *****
  • Posts: 202
  • Karma: +1/-0
  • SuperFly Deving Guy
Re: Goal for 2018
« Reply #7 on: March 15, 2018, 04:38:02 AM »
I... will not go into what the problem was.
Simply know as I programmer I am deeply embarrassed.

I've decided to keep a simple error message for when things go bad, that way I can be told what file was creating an error.
I will upload a build into the untested section of the forums at some point.