Jump to content

Development Updates


johnparker007

Recommended Posts

Started hacking around, then realised I could set up a test on my locally installed version.  So moved MFME install path in the registry to point a new copy on my D drive (ArcadeSim is on the C drive), and it still successfully found MFME at the path.
 

image.png.6adada4aeb6899bccb2b84957789523b.png


I renamed the MFME.exe to also test other stuff I have in that searches for the file by it's unique hash (rather than relying on the file being called MFME.exe).  I suspect my assumption that all MFME.exe's of the latest version are identical may be flawed - perhaps MFME.exe modifies itself in some way... 

So, could I ask a favour @davep180, @Amusements - could you please send me a zipped copy of your MFME.exe file (via DIF message attachment)?  ...that you mentioned is on a drive other than the C drive (and is pointed at in the registry).  Thanks very much in advance! :) 

  • Like 1

[ Arcade Simulator ] Pre-alpha installer: http://arcadesimulator.net  |  Known Issues: https://tinyurl.com/yz4uom2e  |  Donation info: https://tinyurl.com/yzvgl4xo
[ Community Drive ] The drive: http://tinyurl.com/yckze665
[ Fruit Machine Database ] Initial google sheets (WIP): https://tinyurl.com/2c5znxzz
[ Fruit Machine ROM  Archive ] The archive: https://tinyurl.com/3jhzbueb

[ MFME Launch ] Source code: https://github.com/johnparker007/MFMELaunch
[ Oasis ] Source code: https://github.com/johnparker007/Oasis
[ Sound ROM Editor ] Source code: https://github.com/johnparker007/SoundRomEditor

Link to comment
Share on other sites

23 hours ago, johnparker007 said:

Just a quick tech update :) 

Been having a look at a basic 'Machine Options' menu.  So when you are playing a machine, you can press the TAB key, to pull up this menu:

image.thumb.png.7ae74e7d1b2718c54c33f5fbd37887ef.png

'Reset' simply resets the machine.

'Exit (No Save)' would exit the machine without saving the RAM's current state.

'Switches' option gives you these basic switch toggles:

image.thumb.png.35c517f13c06f7d3266cc61b113b3a1a.png

'RAM' option gives you these options:

image.thumb.png.b56250d9a9a64b4c3aa3195a68636788.png

Load/Save will be to load/save to some kind of simple Slot system, perhaps with user-editable names (Happy RAM, Dead RAM etc).

Revert would revert the RAM to the one that came with the original DX layout.

Clear would clear the RAM (and reset machine).  This may lead to some buttons needing to be pressed to initialise the machine again (setting percentages etc).



Just some basic options for now, mainly because I've realised RAMs can go wrong and end up in boot loops, so need at least the Revert option so people don't end up with completely broken machines if that were to happen :)

is this operational when i press tab nothing happens.?

  • Like 1
Link to comment
Share on other sites

6 minutes ago, jabbathehut said:

is this operational when i press tab nothing happens.?

It is not in yet :)  Those screenshots above were previews, it'll probably be in soon though...

  • Like 1

[ Arcade Simulator ] Pre-alpha installer: http://arcadesimulator.net  |  Known Issues: https://tinyurl.com/yz4uom2e  |  Donation info: https://tinyurl.com/yzvgl4xo
[ Community Drive ] The drive: http://tinyurl.com/yckze665
[ Fruit Machine Database ] Initial google sheets (WIP): https://tinyurl.com/2c5znxzz
[ Fruit Machine ROM  Archive ] The archive: https://tinyurl.com/3jhzbueb

[ MFME Launch ] Source code: https://github.com/johnparker007/MFMELaunch
[ Oasis ] Source code: https://github.com/johnparker007/Oasis
[ Sound ROM Editor ] Source code: https://github.com/johnparker007/SoundRomEditor

Link to comment
Share on other sites

Duh that is probably why, got to give it that sharp insert like when we had some funny quid coins going in, use to scratch them on the side or front of the machine to give it that bite going in.

I honestly hate bringing faults to the table so you will have to excuse me as being a Piscean it is my nature I'm afraid.

 

Zippy🤐 

  • Like 1

 

 

Link to comment
Share on other sites

5 hours ago, Big J said:

Duh that is probably why, got to give it that sharp insert like when we had some funny quid coins going in, use to scratch them on the side or front of the machine to give it that bite going in.

I honestly hate bringing faults to the table so you will have to excuse me as being a Piscean it is my nature I'm afraid.

 

Zippy🤐 

No probs, there's plenty of minor bugs, I just can't work on them yet - the JPM coin alarm and Sonic hold button will be fixed when I can though :) 

  • Thanks 1

[ Arcade Simulator ] Pre-alpha installer: http://arcadesimulator.net  |  Known Issues: https://tinyurl.com/yz4uom2e  |  Donation info: https://tinyurl.com/yzvgl4xo
[ Community Drive ] The drive: http://tinyurl.com/yckze665
[ Fruit Machine Database ] Initial google sheets (WIP): https://tinyurl.com/2c5znxzz
[ Fruit Machine ROM  Archive ] The archive: https://tinyurl.com/3jhzbueb

[ MFME Launch ] Source code: https://github.com/johnparker007/MFMELaunch
[ Oasis ] Source code: https://github.com/johnparker007/Oasis
[ Sound ROM Editor ] Source code: https://github.com/johnparker007/SoundRomEditor

Link to comment
Share on other sites

5 hours ago, john888 said:

will there be an over 18's area lol

There will be support for 'props' in the Arcade Editor.  These will be things like potted plants, fire extinguishers, free-standing ash trays, partition walls etc... and could indeed include an 'over 18s sign' prop :) ...should be fairly easy to create, something like this one on the left:

DSC_0094.jpg

(also shows a good example of a wood/glass partition wall - these will make for good props too)

Edited by johnparker007
  • Like 1
  • Awesome 1

[ Arcade Simulator ] Pre-alpha installer: http://arcadesimulator.net  |  Known Issues: https://tinyurl.com/yz4uom2e  |  Donation info: https://tinyurl.com/yzvgl4xo
[ Community Drive ] The drive: http://tinyurl.com/yckze665
[ Fruit Machine Database ] Initial google sheets (WIP): https://tinyurl.com/2c5znxzz
[ Fruit Machine ROM  Archive ] The archive: https://tinyurl.com/3jhzbueb

[ MFME Launch ] Source code: https://github.com/johnparker007/MFMELaunch
[ Oasis ] Source code: https://github.com/johnparker007/Oasis
[ Sound ROM Editor ] Source code: https://github.com/johnparker007/SoundRomEditor

Link to comment
Share on other sites

31 minutes ago, johnparker007 said:

There will be support for 'props' in the Arcade Editor.  These will be things like potted plants, fire extinguishers, free-standing ash trays, partition walls etc... and could indeed include an 'over 18s sign' prop :) ...should be fairly easy to create, something like this one on the left:

DSC_0094.jpg

(also shows a good example of a wood/glass partition wall - these will make for good props too)

This project is looking really good and sounds very promising.

I personally will wait until the first non Dev release comes along as i am pretty useless at PC related things but am really looking forward to the first release.

Thank you for all the time and effort you are putting into it, it is very much appreciated, i am sure.

Ps, we have the acronym MFME for the emulator, for your Arcade Simulator, will it be known as ArSi ? Haha.

Edited by Mavroz
  • Like 3
  • Haha 1
Link to comment
Share on other sites



 

Edited by johnparker007

[ Arcade Simulator ] Pre-alpha installer: http://arcadesimulator.net  |  Known Issues: https://tinyurl.com/yz4uom2e  |  Donation info: https://tinyurl.com/yzvgl4xo
[ Community Drive ] The drive: http://tinyurl.com/yckze665
[ Fruit Machine Database ] Initial google sheets (WIP): https://tinyurl.com/2c5znxzz
[ Fruit Machine ROM  Archive ] The archive: https://tinyurl.com/3jhzbueb

[ MFME Launch ] Source code: https://github.com/johnparker007/MFMELaunch
[ Oasis ] Source code: https://github.com/johnparker007/Oasis
[ Sound ROM Editor ] Source code: https://github.com/johnparker007/SoundRomEditor

Link to comment
Share on other sites

35 minutes ago, Mavroz said:

This project is looking really good and sounds very promising.

I personally will wait until the first non Dev release comes along as i am pretty useless at PC related things but am really looking forward to the first release.

Thank you for all the time and effort you are putting into it, it is very much appreciated, i am sure.

Ps, we have the acronym MFME for the emulator, for your Arcade Simulator, will it be known as ArSi ? Haha.

Thanks mate :)   Oh god - I'd not noticed that!  😂  I've been calling it Arcade Sim for short so far, and the icon is just 'AS'...  I'll try stay away from arsey ArSi !

  • Like 1
  • Haha 3

[ Arcade Simulator ] Pre-alpha installer: http://arcadesimulator.net  |  Known Issues: https://tinyurl.com/yz4uom2e  |  Donation info: https://tinyurl.com/yzvgl4xo
[ Community Drive ] The drive: http://tinyurl.com/yckze665
[ Fruit Machine Database ] Initial google sheets (WIP): https://tinyurl.com/2c5znxzz
[ Fruit Machine ROM  Archive ] The archive: https://tinyurl.com/3jhzbueb

[ MFME Launch ] Source code: https://github.com/johnparker007/MFMELaunch
[ Oasis ] Source code: https://github.com/johnparker007/Oasis
[ Sound ROM Editor ] Source code: https://github.com/johnparker007/SoundRomEditor

Link to comment
Share on other sites

@davep180, @Amusements - hey guys :) 

Ok - I've spent some time and really developed the 'MFME exe finder' so it does a lot more more searching now, from all locations it can get a link to from various MFME registry entries, and some other bits and bobs.  I also have more logging, but hopefully it will now work for you guys.

It's uploaded as the next patch, so if you start ArcadeSim, let it do its thing - hopefully now you will have working machines (as it should fingers crossed find your MFME exe's).

Please do let me know if it doesn't work, and we can check the new detailed logs and hopefully figure out what's going on - cheers :)

This latest patch will very likely help others where the machines aren't working due to not being able to find the MFME exe.

@cja272 - your issue is a different one... could I ask a favour - could you please try specifically Smash 'n' Grab in ArcadeSim?  As that particular machine doesn't have any layout 'popups' at the start - it might work, confirming to us that it's the new code for removing those startup popups causing the issue.

(longer term, I will probably be changing over to system that generates the 'data layouts' completely from scratch, so there won't be startup popups on those data layouts any more to deal with - so the problem may ultimately be solved that way if I can't sort it out sooner)

Edited by johnparker007
  • Like 4

[ Arcade Simulator ] Pre-alpha installer: http://arcadesimulator.net  |  Known Issues: https://tinyurl.com/yz4uom2e  |  Donation info: https://tinyurl.com/yzvgl4xo
[ Community Drive ] The drive: http://tinyurl.com/yckze665
[ Fruit Machine Database ] Initial google sheets (WIP): https://tinyurl.com/2c5znxzz
[ Fruit Machine ROM  Archive ] The archive: https://tinyurl.com/3jhzbueb

[ MFME Launch ] Source code: https://github.com/johnparker007/MFMELaunch
[ Oasis ] Source code: https://github.com/johnparker007/Oasis
[ Sound ROM Editor ] Source code: https://github.com/johnparker007/SoundRomEditor

Link to comment
Share on other sites

Thanks for the update John:)

Here is the feed back:

I revisited AS, and downloaded the latest file (ignored the unsafe MS bollox) and then promptly got "update failed".....However, upon running AS and hitting "Enter" Said machine initialized and ran.

So a big leap forward:)

 

  • Like 1
  • Thanks 1

Treat every day like your last, because one day it will be!

Fruit Machine <<<My new project! 

Link to comment
Share on other sites

3 minutes ago, Amusements said:

Thanks for the update John:)

Here is the feed back:

I revisited AS, and downloaded the latest file (ignored the unsafe MS bollox) and then promptly got "update failed".....However, upon running AS and hitting "Enter" Said machine initialized and ran.

So a big leap forward:)

 

Ah that's great news, thanks for letting me know :)

Edited by johnparker007
  • Like 1

[ Arcade Simulator ] Pre-alpha installer: http://arcadesimulator.net  |  Known Issues: https://tinyurl.com/yz4uom2e  |  Donation info: https://tinyurl.com/yzvgl4xo
[ Community Drive ] The drive: http://tinyurl.com/yckze665
[ Fruit Machine Database ] Initial google sheets (WIP): https://tinyurl.com/2c5znxzz
[ Fruit Machine ROM  Archive ] The archive: https://tinyurl.com/3jhzbueb

[ MFME Launch ] Source code: https://github.com/johnparker007/MFMELaunch
[ Oasis ] Source code: https://github.com/johnparker007/Oasis
[ Sound ROM Editor ] Source code: https://github.com/johnparker007/SoundRomEditor

Link to comment
Share on other sites

3 hours ago, johnparker007 said:

I'll try stay away from arsey ArSi !

You have every reason to be arsey with what you have to deal with day in day out, I don't know how you do it but like I said to someone else a year or so ago I bet it would be fascinating sitting there and watching you work, not an arse kiss just a no brainer. Wouldn't have a damn clue what you were doing though lol.

 

Zippy🤐

 

 

Edited by Big J
Always miss one damn word💩
  • Like 1

 

 

Link to comment
Share on other sites

11 minutes ago, Big J said:

You have every reason to be arsey with what you have to deal with day in day out, I don't know how you do it but like I said to someone else a year or so ago I bet it would be fascinating sitting there and watching you work, not an arse kiss just a no brainer. Wouldn't have a damn clue what you were doing though lol.

 

Zippy🤐

 

 

I don't think it would be all that fascinating haha, just a lot of programming/testing/swearing :) 

Last night and this morning I wrote and tested the majority of this code block below, which is the new thing that does the 'deep searching' for the latest MFME exe on people's systems - here ya go, knock yourself out @Big J ! :) 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using Microsoft.Win32;
using System.IO;
using System.Linq;

public class MFMEExeCopier : MonoBehaviour
{
    public class PotentialPathData
    {
        public string Path;
        public bool SearchCurrentAndUp;
        public bool SearchCurrentAndDown;
    }


    public byte[] MFME_20_2_0_0_Hash;

    private List<PotentialPathData> _initialPotentialPathsData = new List<PotentialPathData>();
    private List<string> _foundLinkedPathsContainingMFMEString = new List<string>();

    private List<string> _recursiveSearchedDownPaths = new List<string>();
    private List<string> _recursiveSearchedUpPaths = new List<string>();

    private List<string> _searchedPaths = new List<string>();

    private string _matchedLatestMFMEExePath = null;


    private void Start()
    {
        TryToCopyMFMEExeIfNotPresent();
    }

    private void TryToCopyMFMEExeIfNotPresent()
    {
        if (MFMEExeHelper.IsLatestMFMEExePresent(MFME_20_2_0_0_Hash))
        {
            Debug.Log("MFMEExeCopier - latest MFME exe already present, doing nothing.");
            return;
        }

        Debug.LogWarning("MFMEExeCopier - latest MFME exe not present, attempting to find...");

        FindInitialPotentialPaths();

        SearchInitialPotentialPaths();

        if (_matchedLatestMFMEExePath == null)
        {
            SearchFoundLinkedPathsContainingMFMEString();
        }

        if(_matchedLatestMFMEExePath != null)
        {
            Debug.LogWarning("MFMEExeCopier - MFME exe found, copying from " + _matchedLatestMFMEExePath);
            File.Copy(_matchedLatestMFMEExePath, MFMEExeHelper.DynamicMFMEExePath, true);
            Debug.LogWarning("MFMEExeCopier - called copy, now MFMEExeHelper.IsLatestMFMEExePresent returning " + MFMEExeHelper.IsLatestMFMEExePresent(MFME_20_2_0_0_Hash));
        }
        else
        {
            Debug.LogError("MFMEExeCopier - MFME exe NOT found!  Search paths:");
            foreach(string searchedPath in _searchedPaths)
            {
                Debug.LogWarning(searchedPath);
            }
        }
    }

    private void FindInitialPotentialPaths()
    {
        _initialPotentialPathsData.Add(new PotentialPathData()
        {
            Path = GetRegistryStringData("InstallPath"),
            SearchCurrentAndUp = true,
            SearchCurrentAndDown = true
        });

        _initialPotentialPathsData.Add(new PotentialPathData()
        {
            Path = GetRegistryStringData("PathName"),
            SearchCurrentAndUp = true,
            SearchCurrentAndDown = true
        });

        _initialPotentialPathsData.Add(new PotentialPathData()
        {
            Path = GetStandardInstallPathOnArcadeSimDrive(),
            SearchCurrentAndUp = true,
            SearchCurrentAndDown = true
        });

        _initialPotentialPathsData.Add(new PotentialPathData()
        {
            Path = GetRegistryStringData("BrowseDir"),
            SearchCurrentAndUp = true,
            SearchCurrentAndDown = true
        });

        _initialPotentialPathsData.Add(new PotentialPathData()
        {
            Path = GetRegistryStringData("ExportDir"),
            SearchCurrentAndUp = true,
            SearchCurrentAndDown = true
        });

        List<string> historyPaths = GetHistoryPaths(); 
        foreach (string historyPath in historyPaths)
        {
            _initialPotentialPathsData.Add(new PotentialPathData()
            {
                Path = historyPath,
                SearchCurrentAndUp = true,
                SearchCurrentAndDown = true
            });
        }

        List<string> additionalFolders = GetAdditionalFolders(); // do this later as including SearchCurrentAndDown which is slow for what are probaly parent layout folders
        foreach(string additionalFolder in additionalFolders)
        {
            _initialPotentialPathsData.Add(new PotentialPathData()
            {
                Path = additionalFolder,
                SearchCurrentAndUp = true,
                SearchCurrentAndDown = true
            });
        }
    }

    private string GetRegistryStringData(string key)
    {
        string registryStringData = (string)Registry.GetValue("HKEY_CURRENT_USER\\SOFTWARE\\CJW\\MFME", key, null);
        if (registryStringData == null)
        {
            Debug.LogError("MFMEExeCopier - couldn't get string data for key [" + key + "] from Windows Registry");
        }

        return registryStringData;
    }

    private List<string> GetAdditionalFolders()
    {
        // 'AdditionalFolders' is semicolon-seperated values e.g: C:\projects\Arcade_MFME\Layouts;C:\downloads

        List<string> additionalFolders = new List<string>();

        string additionalFoldersSemicolonSeperated = GetRegistryStringData("AdditionalFolders");
        if (additionalFoldersSemicolonSeperated != null)
        {
            additionalFolders = additionalFoldersSemicolonSeperated.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries).ToList();
        }

        return additionalFolders;
    }

    private List<string> GetHistoryPaths()
    {
        // in registry as history0, history1 ... history9

        List<string> historyPaths = new List<string>();

        for(int historyPathIndex = 0; historyPathIndex <= 9; ++historyPathIndex)
        {
            string historyPath = GetRegistryStringData("history" + historyPathIndex);
            if(historyPath != null)
            {
                historyPaths.Add(historyPath);
            }
        }

        return historyPaths;
    }

    private string GetStandardInstallPathOnArcadeSimDrive()
    {
        const string kFixedRootPath = "MFME\\v20";
    
        string arcadeSimInstallPathRoot = Path.GetPathRoot(Application.dataPath);
        string standardInstallPathOnArcadeSimDrive = Path.Combine(arcadeSimInstallPathRoot, kFixedRootPath);

        return standardInstallPathOnArcadeSimDrive;
    }

    private void SearchInitialPotentialPaths()
    {
        foreach(PotentialPathData potentialPathData in _initialPotentialPathsData)
        {
            SearchInitialPotentialPath(potentialPathData);

            if(_matchedLatestMFMEExePath != null)
            {
                return;
            }
        }
    }

    private void SearchInitialPotentialPath(PotentialPathData potentialPathData)
    {
        if (potentialPathData.Path == null
            || potentialPathData.Path.Length == 0
            || !Directory.Exists(potentialPathData.Path))
        {
            return;
        }

        if(potentialPathData.SearchCurrentAndDown)
        {
            SearchPotentialPathCurrentAndDown(potentialPathData);
        }

        if (potentialPathData.SearchCurrentAndUp)
        {
            SearchPotentialPathCurrentAndUp(potentialPathData);
        }
    }

    private void SearchPotentialPathCurrentAndDown(PotentialPathData potentialPathData)
    {
        DirectoryInfo potentialPathDirectoryInfo = new DirectoryInfo(potentialPathData.Path);

        RecursiveSearchDown(potentialPathDirectoryInfo);
    }

    private void SearchPotentialPathCurrentAndUp(PotentialPathData potentialPathData)
    {
        DirectoryInfo potentialPathDirectoryInfo = new DirectoryInfo(potentialPathData.Path);

        RecursiveSearchUp(potentialPathDirectoryInfo, true);
    }

    private void RecursiveSearchDown(DirectoryInfo directoryInfo)
    {
        if (!directoryInfo.Exists)
        {
            return;
        }

        if (_matchedLatestMFMEExePath != null)
        {
            return;
        }

        if(_recursiveSearchedDownPaths.Contains(directoryInfo.FullName))
        {
            return;
        }
        _recursiveSearchedDownPaths.Add(directoryInfo.FullName);

        foreach (DirectoryInfo subDirectoryInfo in directoryInfo.EnumerateDirectories())
        {
            RecursiveSearchDown(subDirectoryInfo);
        }

        if(_matchedLatestMFMEExePath == null)
        {
            string mfmeExePath = FindMFMEExePath(directoryInfo.FullName);
            if (mfmeExePath != null)
            {
                _matchedLatestMFMEExePath = mfmeExePath;
                return;
            }
        }
    }

    private void RecursiveSearchUp(DirectoryInfo directoryInfo, bool captureLinkedPathsContainingMFMEString)
    {
        if (!directoryInfo.Exists)
        {
            return;
        }

        if(_matchedLatestMFMEExePath != null)
        {
            return;
        }

        if (_recursiveSearchedUpPaths.Contains(directoryInfo.FullName))
        {
            return;
        }
        _recursiveSearchedUpPaths.Add(directoryInfo.FullName);

        DirectoryInfo parentDirectoryInfo = directoryInfo.Parent;
        if(parentDirectoryInfo != null)
        {
            RecursiveSearchUp(parentDirectoryInfo, captureLinkedPathsContainingMFMEString);
        }

        if(captureLinkedPathsContainingMFMEString)
        {
            FindDirectoriesContainingMFMEString(directoryInfo);
        }

        if (_matchedLatestMFMEExePath == null)
        {
            string mfmeExePath = FindMFMEExePath(directoryInfo.FullName);
            if (mfmeExePath != null)
            {
                _matchedLatestMFMEExePath = mfmeExePath;
                return;
            }
        }
    }

    private void FindDirectoriesContainingMFMEString(DirectoryInfo directoryInfo)
    {
        foreach (string directoryPath in Directory.GetDirectories(directoryInfo.FullName, "*", SearchOption.TopDirectoryOnly))
        {
            bool containsMFMEString = directoryPath.IndexOf("mfme", StringComparison.OrdinalIgnoreCase) >= 0;
            if(containsMFMEString)
            {
                _foundLinkedPathsContainingMFMEString.Add(directoryPath);
            }
        }
    }
    
    private void SearchFoundLinkedPathsContainingMFMEString()
    {
        foreach(string linkedPathContainingMFMEString in _foundLinkedPathsContainingMFMEString)
        {
            if(_matchedLatestMFMEExePath != null)
            {
                return;
            }

            DirectoryInfo potentialPathDirectoryInfo = new DirectoryInfo(linkedPathContainingMFMEString);
            RecursiveSearchDown(potentialPathDirectoryInfo);
            RecursiveSearchUp(potentialPathDirectoryInfo, false);
        }
    }

    private string FindMFMEExePath(string directoryPath)
    {
        if(!Directory.Exists(directoryPath))
        {
            return null;
        }

        if(_searchedPaths.Contains(directoryPath))
        {
            return null;
        }
        _searchedPaths.Add(directoryPath);

        DirectoryInfo directoryInfo = new DirectoryInfo(directoryPath);
        foreach (FileInfo exeFileInfo in directoryInfo.GetFiles("*.exe"))
        {
            if(MFMEExeHelper.IsLatestExe(exeFileInfo.FullName, MFME_20_2_0_0_Hash))
            {
                return exeFileInfo.FullName;
            }
        }

        return null;
    }
    

}

 

Edited by johnparker007
  • Like 1
  • Awesome 1

[ Arcade Simulator ] Pre-alpha installer: http://arcadesimulator.net  |  Known Issues: https://tinyurl.com/yz4uom2e  |  Donation info: https://tinyurl.com/yzvgl4xo
[ Community Drive ] The drive: http://tinyurl.com/yckze665
[ Fruit Machine Database ] Initial google sheets (WIP): https://tinyurl.com/2c5znxzz
[ Fruit Machine ROM  Archive ] The archive: https://tinyurl.com/3jhzbueb

[ MFME Launch ] Source code: https://github.com/johnparker007/MFMELaunch
[ Oasis ] Source code: https://github.com/johnparker007/Oasis
[ Sound ROM Editor ] Source code: https://github.com/johnparker007/SoundRomEditor

Link to comment
Share on other sites

41 minutes ago, johnparker007 said:

I don't think it would be all that fascinating haha, just a lot of programming/testing/swearing :) 

Last night and this morning I wrote and tested the majority of this code block below, which is the new thing that does the 'deep searching' for the latest MFME exe on people's systems - here ya go, knock yourself out @Big J ! :) 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using Microsoft.Win32;
using System.IO;
using System.Linq;

public class MFMEExeCopier : MonoBehaviour
{
    public class PotentialPathData
    {
        public string Path;
        public bool SearchCurrentAndUp;
        public bool SearchCurrentAndDown;
    }


    public byte[] MFME_20_2_0_0_Hash;

    private List<PotentialPathData> _initialPotentialPathsData = new List<PotentialPathData>();
    private List<string> _foundLinkedPathsContainingMFMEString = new List<string>();

    private List<string> _recursiveSearchedDownPaths = new List<string>();
    private List<string> _recursiveSearchedUpPaths = new List<string>();

    private List<string> _searchedPaths = new List<string>();

    private string _matchedLatestMFMEExePath = null;


    private void Start()
    {
        TryToCopyMFMEExeIfNotPresent();
    }

    private void TryToCopyMFMEExeIfNotPresent()
    {
        if (MFMEExeHelper.IsLatestMFMEExePresent(MFME_20_2_0_0_Hash))
        {
            Debug.Log("MFMEExeCopier - latest MFME exe already present, doing nothing.");
            return;
        }

        Debug.LogWarning("MFMEExeCopier - latest MFME exe not present, attempting to find...");

        FindInitialPotentialPaths();

        SearchInitialPotentialPaths();

        if (_matchedLatestMFMEExePath == null)
        {
            SearchFoundLinkedPathsContainingMFMEString();
        }

        if(_matchedLatestMFMEExePath != null)
        {
            Debug.LogWarning("MFMEExeCopier - MFME exe found, copying from " + _matchedLatestMFMEExePath);
            File.Copy(_matchedLatestMFMEExePath, MFMEExeHelper.DynamicMFMEExePath, true);
            Debug.LogWarning("MFMEExeCopier - called copy, now MFMEExeHelper.IsLatestMFMEExePresent returning " + MFMEExeHelper.IsLatestMFMEExePresent(MFME_20_2_0_0_Hash));
        }
        else
        {
            Debug.LogError("MFMEExeCopier - MFME exe NOT found!  Search paths:");
            foreach(string searchedPath in _searchedPaths)
            {
                Debug.LogWarning(searchedPath);
            }
        }
    }

    private void FindInitialPotentialPaths()
    {
        _initialPotentialPathsData.Add(new PotentialPathData()
        {
            Path = GetRegistryStringData("InstallPath"),
            SearchCurrentAndUp = true,
            SearchCurrentAndDown = true
        });

        _initialPotentialPathsData.Add(new PotentialPathData()
        {
            Path = GetRegistryStringData("PathName"),
            SearchCurrentAndUp = true,
            SearchCurrentAndDown = true
        });

        _initialPotentialPathsData.Add(new PotentialPathData()
        {
            Path = GetStandardInstallPathOnArcadeSimDrive(),
            SearchCurrentAndUp = true,
            SearchCurrentAndDown = true
        });

        _initialPotentialPathsData.Add(new PotentialPathData()
        {
            Path = GetRegistryStringData("BrowseDir"),
            SearchCurrentAndUp = true,
            SearchCurrentAndDown = true
        });

        _initialPotentialPathsData.Add(new PotentialPathData()
        {
            Path = GetRegistryStringData("ExportDir"),
            SearchCurrentAndUp = true,
            SearchCurrentAndDown = true
        });

        List<string> historyPaths = GetHistoryPaths(); 
        foreach (string historyPath in historyPaths)
        {
            _initialPotentialPathsData.Add(new PotentialPathData()
            {
                Path = historyPath,
                SearchCurrentAndUp = true,
                SearchCurrentAndDown = true
            });
        }

        List<string> additionalFolders = GetAdditionalFolders(); // do this later as including SearchCurrentAndDown which is slow for what are probaly parent layout folders
        foreach(string additionalFolder in additionalFolders)
        {
            _initialPotentialPathsData.Add(new PotentialPathData()
            {
                Path = additionalFolder,
                SearchCurrentAndUp = true,
                SearchCurrentAndDown = true
            });
        }
    }

    private string GetRegistryStringData(string key)
    {
        string registryStringData = (string)Registry.GetValue("HKEY_CURRENT_USER\\SOFTWARE\\CJW\\MFME", key, null);
        if (registryStringData == null)
        {
            Debug.LogError("MFMEExeCopier - couldn't get string data for key [" + key + "] from Windows Registry");
        }

        return registryStringData;
    }

    private List<string> GetAdditionalFolders()
    {
        // 'AdditionalFolders' is semicolon-seperated values e.g: C:\projects\Arcade_MFME\Layouts;C:\downloads

        List<string> additionalFolders = new List<string>();

        string additionalFoldersSemicolonSeperated = GetRegistryStringData("AdditionalFolders");
        if (additionalFoldersSemicolonSeperated != null)
        {
            additionalFolders = additionalFoldersSemicolonSeperated.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries).ToList();
        }

        return additionalFolders;
    }

    private List<string> GetHistoryPaths()
    {
        // in registry as history0, history1 ... history9

        List<string> historyPaths = new List<string>();

        for(int historyPathIndex = 0; historyPathIndex <= 9; ++historyPathIndex)
        {
            string historyPath = GetRegistryStringData("history" + historyPathIndex);
            if(historyPath != null)
            {
                historyPaths.Add(historyPath);
            }
        }

        return historyPaths;
    }

    private string GetStandardInstallPathOnArcadeSimDrive()
    {
        const string kFixedRootPath = "MFME\\v20";
    
        string arcadeSimInstallPathRoot = Path.GetPathRoot(Application.dataPath);
        string standardInstallPathOnArcadeSimDrive = Path.Combine(arcadeSimInstallPathRoot, kFixedRootPath);

        return standardInstallPathOnArcadeSimDrive;
    }

    private void SearchInitialPotentialPaths()
    {
        foreach(PotentialPathData potentialPathData in _initialPotentialPathsData)
        {
            SearchInitialPotentialPath(potentialPathData);

            if(_matchedLatestMFMEExePath != null)
            {
                return;
            }
        }
    }

    private void SearchInitialPotentialPath(PotentialPathData potentialPathData)
    {
        if (potentialPathData.Path == null
            || potentialPathData.Path.Length == 0
            || !Directory.Exists(potentialPathData.Path))
        {
            return;
        }

        if(potentialPathData.SearchCurrentAndDown)
        {
            SearchPotentialPathCurrentAndDown(potentialPathData);
        }

        if (potentialPathData.SearchCurrentAndUp)
        {
            SearchPotentialPathCurrentAndUp(potentialPathData);
        }
    }

    private void SearchPotentialPathCurrentAndDown(PotentialPathData potentialPathData)
    {
        DirectoryInfo potentialPathDirectoryInfo = new DirectoryInfo(potentialPathData.Path);

        RecursiveSearchDown(potentialPathDirectoryInfo);
    }

    private void SearchPotentialPathCurrentAndUp(PotentialPathData potentialPathData)
    {
        DirectoryInfo potentialPathDirectoryInfo = new DirectoryInfo(potentialPathData.Path);

        RecursiveSearchUp(potentialPathDirectoryInfo, true);
    }

    private void RecursiveSearchDown(DirectoryInfo directoryInfo)
    {
        if (!directoryInfo.Exists)
        {
            return;
        }

        if (_matchedLatestMFMEExePath != null)
        {
            return;
        }

        if(_recursiveSearchedDownPaths.Contains(directoryInfo.FullName))
        {
            return;
        }
        _recursiveSearchedDownPaths.Add(directoryInfo.FullName);

        foreach (DirectoryInfo subDirectoryInfo in directoryInfo.EnumerateDirectories())
        {
            RecursiveSearchDown(subDirectoryInfo);
        }

        if(_matchedLatestMFMEExePath == null)
        {
            string mfmeExePath = FindMFMEExePath(directoryInfo.FullName);
            if (mfmeExePath != null)
            {
                _matchedLatestMFMEExePath = mfmeExePath;
                return;
            }
        }
    }

    private void RecursiveSearchUp(DirectoryInfo directoryInfo, bool captureLinkedPathsContainingMFMEString)
    {
        if (!directoryInfo.Exists)
        {
            return;
        }

        if(_matchedLatestMFMEExePath != null)
        {
            return;
        }

        if (_recursiveSearchedUpPaths.Contains(directoryInfo.FullName))
        {
            return;
        }
        _recursiveSearchedUpPaths.Add(directoryInfo.FullName);

        DirectoryInfo parentDirectoryInfo = directoryInfo.Parent;
        if(parentDirectoryInfo != null)
        {
            RecursiveSearchUp(parentDirectoryInfo, captureLinkedPathsContainingMFMEString);
        }

        if(captureLinkedPathsContainingMFMEString)
        {
            FindDirectoriesContainingMFMEString(directoryInfo);
        }

        if (_matchedLatestMFMEExePath == null)
        {
            string mfmeExePath = FindMFMEExePath(directoryInfo.FullName);
            if (mfmeExePath != null)
            {
                _matchedLatestMFMEExePath = mfmeExePath;
                return;
            }
        }
    }

    private void FindDirectoriesContainingMFMEString(DirectoryInfo directoryInfo)
    {
        foreach (string directoryPath in Directory.GetDirectories(directoryInfo.FullName, "*", SearchOption.TopDirectoryOnly))
        {
            bool containsMFMEString = directoryPath.IndexOf("mfme", StringComparison.OrdinalIgnoreCase) >= 0;
            if(containsMFMEString)
            {
                _foundLinkedPathsContainingMFMEString.Add(directoryPath);
            }
        }
    }
    
    private void SearchFoundLinkedPathsContainingMFMEString()
    {
        foreach(string linkedPathContainingMFMEString in _foundLinkedPathsContainingMFMEString)
        {
            if(_matchedLatestMFMEExePath != null)
            {
                return;
            }

            DirectoryInfo potentialPathDirectoryInfo = new DirectoryInfo(linkedPathContainingMFMEString);
            RecursiveSearchDown(potentialPathDirectoryInfo);
            RecursiveSearchUp(potentialPathDirectoryInfo, false);
        }
    }

    private string FindMFMEExePath(string directoryPath)
    {
        if(!Directory.Exists(directoryPath))
        {
            return null;
        }

        if(_searchedPaths.Contains(directoryPath))
        {
            return null;
        }
        _searchedPaths.Add(directoryPath);

        DirectoryInfo directoryInfo = new DirectoryInfo(directoryPath);
        foreach (FileInfo exeFileInfo in directoryInfo.GetFiles("*.exe"))
        {
            if(MFMEExeHelper.IsLatestExe(exeFileInfo.FullName, MFME_20_2_0_0_Hash))
            {
                return exeFileInfo.FullName;
            }
        }

        return null;
    }
    

}

 

You pisstaker, you really dropped me in it, is this a ploy to shut me up roflmfao.

Awesome though mate still whatever the fuck it is.

 

Zippy🤐

  • Like 1
  • Haha 1

 

 

Link to comment
Share on other sites

4 hours ago, johnparker007 said:



@cja272 - your issue is a different one... could I ask a favour - could you please try specifically Smash 'n' Grab in ArcadeSim?  As that particular machine doesn't have any layout 'popups' at the start - it might work, confirming to us that it's the new code for removing those startup popups causing the issue.

(longer term, I will probably be changing over to system that generates the 'data layouts' completely from scratch, so there won't be startup popups on those data layouts any more to deal with - so the problem may ultimately be solved that way if I can't sort it out sooner)

Hi,
Ive just tried it with Smash n Grab and also a few other machines and its just the same im afraid still getting the same error messages

 

Link to comment
Share on other sites

22 minutes ago, cja272 said:

Hi,
Ive just tried it with Smash n Grab and also a few other machines and its just the same im afraid still getting the same error messages

Thanks for the test and the info :) 

I'm not sure at this stage why it is different on your PC to other PCs... I will need to have a think.  I'm doing different stuff now to control parts of the MFME lifecycle (to allow us to have save games etc), for some reason your machine doesn't like it.

Bear with me, I will keep working on this (along with the other 'MFME control' stuff I've got lined up with the Machine Options)... we'll get there :) 

  • Like 2

[ Arcade Simulator ] Pre-alpha installer: http://arcadesimulator.net  |  Known Issues: https://tinyurl.com/yz4uom2e  |  Donation info: https://tinyurl.com/yzvgl4xo
[ Community Drive ] The drive: http://tinyurl.com/yckze665
[ Fruit Machine Database ] Initial google sheets (WIP): https://tinyurl.com/2c5znxzz
[ Fruit Machine ROM  Archive ] The archive: https://tinyurl.com/3jhzbueb

[ MFME Launch ] Source code: https://github.com/johnparker007/MFMELaunch
[ Oasis ] Source code: https://github.com/johnparker007/Oasis
[ Sound ROM Editor ] Source code: https://github.com/johnparker007/SoundRomEditor

Link to comment
Share on other sites

9 minutes ago, davep180 said:

Thanks for the update JP. I’m away visiting family at the moment, but I’ll load it up as soon as I get home tomorrow night and report back. 

Have a great weekend, honestly no hurry on testing it bud - but I'm fairly optimistic it will work for you now :) 

  • Like 2

[ Arcade Simulator ] Pre-alpha installer: http://arcadesimulator.net  |  Known Issues: https://tinyurl.com/yz4uom2e  |  Donation info: https://tinyurl.com/yzvgl4xo
[ Community Drive ] The drive: http://tinyurl.com/yckze665
[ Fruit Machine Database ] Initial google sheets (WIP): https://tinyurl.com/2c5znxzz
[ Fruit Machine ROM  Archive ] The archive: https://tinyurl.com/3jhzbueb

[ MFME Launch ] Source code: https://github.com/johnparker007/MFMELaunch
[ Oasis ] Source code: https://github.com/johnparker007/Oasis
[ Sound ROM Editor ] Source code: https://github.com/johnparker007/SoundRomEditor

Link to comment
Share on other sites

An update.

After pressing enter, the machine appears as though it's going to boot up, like the reels move slightly and the alpha light. EDIT....The alpha changes to all ????????? and the 7 segs show 888

Then nothing.

If I then alt/tab, MFME is running with the machine loaded, but only with the very top of the cabinet in the layout showing.

Attached a picture, which I've reduce the quality of to save mb's

as.png

Edited by wearecity
  • Thanks 1
Link to comment
Share on other sites

1 hour ago, johnparker007 said:

Thanks for the test and the info :) 

I'm not sure at this stage why it is different on your PC to other PCs... I will need to have a think.  I'm doing different stuff now to control parts of the MFME lifecycle (to allow us to have save games etc), for some reason your machine doesn't like it.

Bear with me, I will keep working on this (along with the other 'MFME control' stuff I've got lined up with the Machine Options)... we'll get there :) 

I've got it working!!!!

If i open up the arcade simulator and run as administrator it works 😀

  • Thanks 1
Link to comment
Share on other sites

×
×
  • Create New...