Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Playing a little bit with power shell
#1
So im into power shell alot lately and i want to try and do something with lf2 through ps
Can anyone tell me the idea of how to load a .dat file like all the dc editors?
Main idea can be cool i want to try and write it by myself, but i dont have knowledge in anything else that connect to programing so i dont realy know what to try in order to read the files
Anyway, idea on how to read the file would be great
[Image: p45mycA.png]
Reply
Thanks given by:
#2
1-Open the file for reading and store what's inside into a variable (or stream it, whatever you prefer/have available). The content of the file is gibberish (because it's encrypted).

2-Skip over the first one hundred and twenty three characters and start going through all characters in the file. Since counting in computers starts from 0, this means you will start from the 124rd letter character (index 123).

3-For every character you go through, convert it to its ASCII code, subtract from it the ASCII code of the Nth character in the key "odBearBecauseHeIsVeryGoodSiuHungIsAGo" (yes, the letters are shifted because there is a caeser cipher step we can skip with using this shifted key).

4- N is an index in the key which keeps increasing for every character and restarts back to 0 when it reaches the end of the key.
[Image: signature.png]
A-Engine: A new beat em up game engine inspired by LF2. Coming soon

A-Engine Dev Blog - Update #8: Timeout

Reply
Thanks given by: Ariel , MangaD
#3
the hell is power shell !!
                            LF Extended                              [Image: 2518290.gif][Image: e38dd1f.gif][Image: 533172c.gif] (click on the pic)                       Deviantart
                            Might be back, might be not :^) anyways awesome to see you guys again!
Reply
Thanks given by:
#4
Code:
$data = Get-Content E:\LittleFighter\data\template.dat -Encoding Byte
[int]$c = 123
[string]$bear = "odBearBecauseHeIsVeryGoodSiuHungIsAGo"
[int]$bc = 0
[string[]]$arr = @()
while ($c -ne $data.Length)
{
    $dshift = [int]$data[$c] + [int]$bear[$bc]
    $c = $c + 1
    if ($bc -eq 37)
    {
        $bc = 0
    }
    else
    {
        $bc = $bc + 1
    }
    [char]$dshift
}

still gives me weird letters :\
[Image: p45mycA.png]
Reply
Thanks given by:
#5
You have a problem here:
Code:
if ($bc -eq 37)
   {
       $bc = 0
   }
   else
   {
       $bc = $bc + 1
   }
You're checking if $bc equals 37, and only then you reset it back to 0. This means that the actual operation uses $bc with 37 before it's resetted, but the index that reaches the last character in the key is 36. Try changing that to 36.

Edit: I missed up with something. You subtract the ASCII value you get from the key, not add. You add when you want to encrypt (reverse the process completely).
[Image: signature.png]
A-Engine: A new beat em up game engine inspired by LF2. Coming soon

A-Engine Dev Blog - Update #8: Timeout

Reply
Thanks given by: Ariel
#6
thanks alot now its working!
edit:

btw any idea on how to get clear lines?
now it gives me the output char by char like this:

b
d
y
:






k
i
n
d
:

0


x
:

2
7
[Image: p45mycA.png]
Reply
Thanks given by:
#7
Depends on how you output your data. If it's to a terminal, and you use something analogous to "echo", it will finish what it types with a newline character ('\n'). See if there is something like printf in power shell, and use it. Or anything which doesn't print a new line character after it. If you're stuck with echo, or if you want to output what you have into a text file or something, then just append/push_back your characters to a string/character-array and print it/save it as a whole once it's done.
[Image: signature.png]
A-Engine: A new beat em up game engine inspired by LF2. Coming soon

A-Engine Dev Blog - Update #8: Timeout

Reply
Thanks given by: Ariel , Hate




Users browsing this thread: 1 Guest(s)