Search code examples
javascriptnode.jselectronhaxeflixel

Would it have a solution to read the ".sol" type file of the HaxelFlixel software in javascript?


I try to extract data from a ".sol" file, this file comes out of the data stored in the game Friday night funkin. I try to get the score of each week from this file to display it from a web page For information I use the packet "electron" to help me to do this.

I would be happy to learn how to read this type of data to continue!

Thanks to those who took the time to read !

By opening the ".sol" file, I understood at first that it was not easy to read, and that it was probably made only for HaxelFlixel (Software that uses the game), time after time I understood that the ":" separate the total data, and that the stored data was between an "i". So I tried to do this in javascript but not all data do this. It gave me a very untidy code (I am bad):

//namesearch: name of the folder where the file we need is located
  async function writescoreweek(namesearch) {
    try {
      var current = [];
      const search = ["week9", "week8", "week7", "week6", "week5", "week4", "week3", "week2", "week1", "week0"];
      for (var i = 0; i < search.length; i++) {
        var searchfct = searchscoreweek(`${namesearch}`, search[i]);
        if (searchfct != "") {
          let student = {
            name: search[i],
            score: searchfct
          };
          (current).push(student);
        }
      }
    } catch (err) {
      console.log(err)
    } finally {
      await fs.writeFileSync(`./data/${namesearch}.json`, JSON.stringify(current, null, 4));
      var weekjson = await require(`./data/${namesearch}.json`);
      return weekjson
    }
  }



  function searchscoreweek(game, search) {
    try {
      const helloPath = path.resolve(__dirname, `${process.env.APPDATA}/ShadowMario/${game}/ninjamuffin99/`, 'funkin.sol');
      const helloSource = fs.readFileSync(helloPath, 'utf8');
      var debut = helloSource.substring(
        helloSource.indexOf("i") + 1,
        helloSource.lastIndexOf("y")
      );
      debut = debut.split(":")
      //console.log(debut)
      var after = [];
      for (var i = 0; i < debut.length; i++) {
        if (debut[i].search(`${search}`) != -1) {
          after.push(debut[i])
        }
      }
    } catch (err) {

    } finally {
      //console.log(after)
      var fin = [];
      for (var i = 0; i < after.length; i++) {
        fin.push(after[i].substring(
          after[i].indexOf("i") + 1,
          after[i].lastIndexOf("y")
        ));
      }
      var apresfin = [];
      for (var i = 0; i < fin.length; i++) {
        if (fin[i].search(`${search}`) == -1) {
          apresfin.push(fin[i])
        }

      }
      return apresfin;
    }
  }

So I concluded that it must be a file type propietaire!

I'm thinking of using "hxnodejs" but I don't see how I can do it at all.

oy11:timeBarTypey11:Time%20Lefty11:comboOffsetazzzzhy8:arrowHSVaazzzhazzzhazzzhazzzhhy12:middleScrollfy9:scoreZoomty10:noteOffsetzy12:ghostTappingty14:healthBarAlphai1y12:noteSplashesty16:gameplaySettingsby12:opponentplayfy9:instakillfy11:scrollspeedi1y9:songspeedi1y7:botplayfy8:practicefy10:healthgaini1y10:scrolltypey14:multiplicativey10:healthlossi1hy10:lowQualityfy7:showFPSty10:goodWindowi90y9:frameratei144y7:noResetfy7:shadersfy10:sickWindowi45y10:downScrollfy12:ratingOffsetzy8:camZoomsty10:songRatingby8:foreplayd0.887971698113208y11:malfunctiond0.8996138996139y11:donnie-softd0.834459459459459y14:encounter-nullzy9:encounterd0.955947136563877y14:encounter-hardzy3:sexzy10:drift-easyd0.87639405204461y16:malfunction-hardzy16:donnie-soft-hardzy5:driftzy6:insaned0.854901960784314y8:aye-papid0.91304347826087y17:kagayaku-kassettod0.875y4:uhohd0.822265625y9:uhoh-hardzy22:kagayaku-kassetto-hardzy8:collapsezy11:insane-hardzy16:malfunction-easyzy10:drift-hardzhy8:flashingty10:safeFramesi10y13:henchmenDeathzy10:weekScoresby10:week9-easyzy6:week10zy10:week8-easyzy10:week9-hardzy5:week7zy11:week10-easyzy10:week8-hardzy10:week7-easyi278330y5:week8i157270y11:week10-hardzy10:week7-hardzy5:week9zhy7:hideHudfy9:badWindowi135y14:hitsoundVolumezy10:songScoresbR32i61930R33i77360R34i40520R35zR36i73500R37zR38zR39i77510R40zR41zR42zR43i71110R44i34550R45i43510R46i67800R47zR48zR49zR50zR51zR52zhy13:weekCompletedbR65tR61thy18:globalAntialiasingty15:achievementsMapby17:friday_night_playthy10:fullscreenfy13:imagesPersistfy14:controllerModefg

I would like to be able to read this type of file as you would read a ".json" file


Solution

  • In haxe you could use Unserializer haxe function (specification of format) to get data. On online Haxe sandbox (https://try.haxe.org/#288Ba882) you could check tab "JS Source" to see code compiled in js.