Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to build the program #4

Open
akewate opened this issue Mar 5, 2019 · 40 comments
Open

How to build the program #4

akewate opened this issue Mar 5, 2019 · 40 comments

Comments

@akewate
Copy link

akewate commented Mar 5, 2019

I have installed visual studio 2017 and cloned the repo. Then in the build properties of the file "LOTD.sln" I set the active solution platform to x64 as you said in #2 . Then I successfully build the file, however when I run it with administrator privileges nothing happens. I don't know what I'm doing wrong

@pixeltris
Copy link
Owner

When you run the program it should open a window as seen on the main page of this github, at which point you can open the game. It sounds like the window never opens for you? Does it crash? If not my guess is that one of the following lines gets stuck in an infinite loop:

Manager.Load();

MemTools = new MemTools();

MemTools.RunProcessWatcher();

If you are running a pirated version of the game it might fail to load it tries to load data files from the steam folder.

@SnakeDeath
Copy link

it says invalid directory is it because my steam folder not in the main drive (C:) , steam is installed on a different drive.

@pixeltris
Copy link
Owner

It should try to get the steam install directory based on the install path https://github.com/pixeltris/Lotd/blob/master/Lotd/LotdArchive.cs#L381. This registry key might not be on all systems?

@SnakeDeath
Copy link

It should try to get the steam install directory based on the install path https://github.com/pixeltris/Lotd/blob/master/Lotd/LotdArchive.cs#L381. This registry key might not be on all systems?

thx , for some reason i dont have it
ill try to fix it

@pixeltris
Copy link
Owner

Do you have the registry key listed here https://stackoverflow.com/a/34091380? This might be a better alternative, I'll look into changing the code to use that if so.

@SnakeDeath
Copy link

Do you have the registry key listed here https://stackoverflow.com/a/34091380? This might be a better alternative, I'll look into changing the code to use that if so.

i do have it , why not make so the program ask for the location every time u run it ?

@SnakeDeath
Copy link

also after adding the reg key this error occurred

System.TypeInitializationException
HResult=0x80131534
Message=The type initializer for 'Lotd.MemTools' threw an exception.
Source=Lotd
StackTrace:
at Lotd.MemTools..ctor() in E:\Users\snake\Desktop\Lotd-master\Lotd\NativeScript\MemTools.cs:line 49
at Lotd.Program.Main() in E:\Users\snake\Desktop\Lotd-master\Lotd\Program.cs:line 30

@pixeltris
Copy link
Owner

pixeltris commented May 21, 2019

Yea it's probably a good idea to prompt for the steam directory if it isn't found.

Hmm that particular crash is quite difficult to know what is going wrong. System.TypeInitializationException is thrown whenever the .NET runtime failed to load a type in the code (class, struct, delegate, or similar). Unfortunately it has one of the least helpful errors (it doesn't tell you what failed to load) so I'm not sure what to suggest in this case.

Try running it as admin? Though it should be doing this already. It also might be trying to run in x86 mode for some reason which could be causing issues. You could try changing the project settings to use x64 instead of AnyCPU.

@SnakeDeath
Copy link

it is as admin because 1st time i run it VS asked for a restart with admin privileges

thats what happen when it runs

Annotation 2019-05-21 050323

@SnakeDeath
Copy link

okay changed it to x64 and it worked
but i feel like some functions are not working

@pixeltris
Copy link
Owner

pixeltris commented May 21, 2019

When you run the program it should open the UI as seen on the main github page. You then need to open the game exe. Once the game is fully opened you should be able to interact with the buttons.

@SnakeDeath
Copy link

the game always crashes

@pixeltris
Copy link
Owner

pixeltris commented May 21, 2019

Thread.Sleep(2000);
This delay might need to be higher (or potentially lower) for you. If it loads too fast then it could corrupt the memory of the game exe which would result in a crash. I need to improve this so that it can detect when it's safe to load.

@SnakeDeath
Copy link

how much do u think i should put it ?

@pixeltris
Copy link
Owner

pixeltris commented May 21, 2019

The delay should be roughly the time it takes for the game window to open (and possibly also the time it takes to start displaying the logo).

It could be that something is just going horribly wrong. I made this tool in my spare time for fun and haven't tested it on anything other than my PC. Sorry if it doesn't work out!

@SnakeDeath
Copy link

np its still amazing that u took the time to do this
its ok if it didnt work ,not that big of a problem

so my game takes 1,5 sec to konami logo , 4 sec to Other Ocean logo and 6 sec to Yugioh logo
ive tried all of them still crashes

@pixeltris
Copy link
Owner

pixeltris commented May 21, 2019

Unfortunately it sounds like something is going horribly wrong. This tool does quite a lot of things to the native memory of the game executable in order to be able to view decks, start duels, etc https://github.com/pixeltris/Lotd/blob/master/Lotd/NativeScript/MemTools.Addresses.cs here are some of the addresses it uses to do this. And the C program that gets injected https://github.com/pixeltris/Lotd/blob/master/Lotd/NativeScript/NativeScript.c. The only real way of working out what is going wrong is debugging the assembly and seeing what is going wrong. It's not so easy unfortunately.

What did you want to use the tool for? Starting duels? There is this project if you're interested in modding files https://github.com/Arefu/Wolf. Or if you're interested in modifying the save data, the save data file format is documented here https://github.com/pixeltris/Lotd/tree/master/Lotd/SaveData. Or use the save tool in the Wolf project https://github.com/Arefu/Wolf/tree/master/Elroy.

@SnakeDeath
Copy link

Starting duels , it looked interesting
also ive tried Wolf project for import and export not working and it seems like its not gonna get fixed soon

@pixeltris
Copy link
Owner

Could you tell me what operating system you are on? I have only tested on W7 x64 pro. If you're using something different I could try the setup you're using to see if I can reproduce the crashes so that I can fix them.

@SnakeDeath
Copy link

SnakeDeath commented May 21, 2019

Win10 pro x64 version 1809 build 17763.503

@pixeltris
Copy link
Owner

Thanks. I will try it and let you know if I can reproduce and fix this issue (this might take a little while as I set up a machine or VM for this).

@SnakeDeath
Copy link

np , take your time
im studying programming (still bad xd) but i know how much pain it is and how much time it takes ,
ty for ur time ^^

@pixeltris
Copy link
Owner

I installed W10 1809 and unfortunately I haven't been able to reproduce the crash. You could try opening the tool after fully opening the game but I have a feeling it will result in the same crash. Sorry I couldn't help!

@pixeltris
Copy link
Owner

Yes it works as expected for me. It's unlikely you are doing anything wrong. There is probably an issue with something it's doing with the memory of the game.

@SnakeDeath
Copy link

after reinstalling the game the tool works fine , it was probably after using Wolf project and unpack the .data file somehow ive missed up something in the files
sorry for causing u trouble

@pixeltris
Copy link
Owner

Great, yea it could possibly have issues with loading some of the data files in that case. I don't think there are currently any errors which show in such cases.

@SnakeDeath
Copy link

the view button for what ? and the export button exported deck in YDL is there a way to import decks ? other than wolf project because its not working

@pixeltris
Copy link
Owner

pixeltris commented May 21, 2019

The view button lets you view the selected deck in the games deck editor (it will wipe over deck slot 32 to do this though!). Currently it exports / imports to the internal format used by the LOTD game exe (which is different to the commonly used YDK). I didn't get around to supporting YDK files (but it shouldn't be too hard if you wanted to add the code to do this).

@SnakeDeath
Copy link

i see, ill try to do it

@SnakeDeath
Copy link

No luck so far

@pixeltris
Copy link
Owner

pixeltris commented May 22, 2019

I could add this feature if you want, you'd want an option to import / export YDK files, yea? The card ids that YDK files use are slightly different. Do you know if there is a list somewhere which maps these two card ids together (YDK card id - official card id).

@EyderSnob
Copy link

Hey there,
Maybe look at the PatchDraft programm from thomasneff? It can import .ydk files into Battle Packs.

I personally came across this project today and invested several hours to get it to work. Programm starts up fine but directly after i launch it my Game stops running. Afterwards i have to reset YGO_Data.toc and YGO_Data.dat to get my game running again. Any advise?

Getting Duels to start fast seems super interesting and it would be ashame if it wouldn't work because of my "not"knowledge.

Regards

@SnakeDeath
Copy link

SnakeDeath commented May 22, 2019

I could add this feature if you want, you'd want an option to import / export YDK files, yea? The card ids that YDK files use are slightly different. Do you know if there is a list somewhere which maps these two card ids together (YDK card id - official card id).

idk if this can help
https://db.ygoprodeck.com/api/v4/cardinfo.php
https://github.com/eijiuema/YDKList

@SnakeDeath
Copy link

Hey there,
Maybe look at the PatchDraft programm from thomasneff? It can import .ydk files into Battle Packs.

I personally came across this project today and invested several hours to get it to work. Programm starts up fine but directly after i launch it my Game stops running. Afterwards i have to reset YGO_Data.toc and YGO_Data.dat to get my game running again. Any advise?

Getting Duels to start fast seems super interesting and it would be ashame if it wouldn't work because of my "not"knowledge.

Regards

YGOLOTDPatchDraft unpack the decks in ydc and even that never got it to work YGO_DATA always fails to load after the repack

@pixeltris
Copy link
Owner

pixeltris commented May 22, 2019

Thanks for the card list. f072afb This commit adds support for YDK files. Create a folder called "Decks" next to the tool exe, and add your YDK files in there. The export button now prompts to either export as YDK or YDL (YDL preserves the duelist avatar info, YDK will always use Joey for now). The YDK / YDL files appear under the "File" section of the dropdown list.

There were a few missing card ids using that card list you provided (their names are probably slightly different to the game names, so it couldn't find them). I'm not sure if they matter or not. You can manually add any missing card ids to the YdkIds.txt file.

Couldn't find YDK card 'Sheep Token' (3902)
Couldn't find YDK card 'Sheep Token' (3903)
Couldn't find YDK card 'Sheep Token' (3904)
Couldn't find YDK card 'Slime Token' (3907)
Couldn't find YDK card 'Ojama Token' (3915)
Couldn't find YDK card 'Ojama Token' (3916)
Couldn't find YDK card 'Lamb Token' (3918)
Couldn't find YDK card 'Fluff Token' (3925)
Couldn't find YDK card 'Maize Token' (3966)
Couldn't find YDK card 'Umbral Horror Mirage Token' (3980)
Couldn't find YDK card 'Kagemusha Raccoon Token' (3981)
Couldn't find YDK card 'Manipulator Token' (3984)
Couldn't find YDK card 'Dragon Lord Token' (3995)
Couldn't find YDK card 'Winged Dragon, Guardian of the Fortress #1' (4013)
Couldn't find YDK card 'Rock Ogre Grotto #1' (4034)
Couldn't find YDK card 'Crawling Dragon #2' (4087)
Couldn't find YDK card 'Necrolancer the Timelord' (4149)
Couldn't find YDK card 'M-Warrior #1' (4166)
Couldn't find YDK card 'M-Warrior #2' (4167)
Couldn't find YDK card 'Fiend Reflection #2' (4192)
Couldn't find YDK card 'LaLa Li-oon' (4197)
Couldn't find YDK card 'Twin Long Rods #1' (4212)
Couldn't find YDK card 'Master & Expert' (4254)
Couldn't find YDK card 'Nekogal #1' (4258)
Couldn't find YDK card 'Rock Ogre Grotto #2' (4269)
Couldn't find YDK card 'Mystical Sheep #2' (4288)
Couldn't find YDK card 'Jinzo #7' (4428)
Couldn't find YDK card 'Kuwagata α' (4486)
Couldn't find YDK card 'Winged Dragon, Guardian of the Fortress #2' (4558)
Couldn't find YDK card 'Mushroom Man #2' (4559)
Couldn't find YDK card 'Tyhone #2' (4561)
Couldn't find YDK card 'Steel Ogre Grotto #1' (4563)
Couldn't find YDK card 'Man-eating Black Shark' (4571)
Couldn't find YDK card 'Fiend Reflection #1' (4601)
Couldn't find YDK card 'Key Mace #2' (4606)
Couldn't find YDK card 'Twin Long Rods #2' (4612)
Couldn't find YDK card 'Nekogal #2' (4633)
Couldn't find YDK card 'Mystical Sheep #1' (4648)
Couldn't find YDK card 'Steel Ogre Grotto #2' (4741)
Couldn't find YDK card 'Alpha The Magnet Warrior' (4744)
Couldn't find YDK card 'Beta The Magnet Warrior' (4763)
Couldn't find YDK card 'Gamma The Magnet Warrior' (4792)
Couldn't find YDK card 'Tribute to The Doomed' (4856)
Couldn't find YDK card 'Flying Kamakiri #1' (4927)
Couldn't find YDK card 'Morphing Jar #2' (4969)
Couldn't find YDK card 'Darkfire Soldier #1' (4973)
Couldn't find YDK card 'Darkfire Soldier #2' (4975)
Couldn't find YDK card 'Flying Kamakiri #2' (4979)
Couldn't find YDK card 'Gift of The Mystical Elf' (4986)
Couldn't find YDK card 'Skull Knight #2' (5306)
Couldn't find YDK card 'Luster Dragon #2' (5349)
Couldn't find YDK card 'Null and Void' (5362)
Couldn't find YDK card 'After the Struggle' (5394)
Couldn't find YDK card 'Vampire Orchis' (5588)
Couldn't find YDK card 'Sasuke Samurai #2' (5764)
Couldn't find YDK card 'Sasuke Samurai #3' (5821)
Couldn't find YDK card 'Sasuke Samurai #4' (6185)
Couldn't find YDK card 'Big Core' (6199)
Couldn't find YDK card 'Summon Reactor ・SK' (7998)
Couldn't find YDK card 'Trap Reactor ・Y FI' (8000)
Couldn't find YDK card 'Spell Reactor ・RE' (8002)
Couldn't find YDK card 'Metaphysical Regeneration' (8072)
Couldn't find YDK card 'Falchionβ' (8330)
Couldn't find YDK card 'Forbidden Graveyard' (8835)
Couldn't find YDK card 'Vampire Koala' (8858)
Failed to find 65 YDK card ids

@pixeltris
Copy link
Owner

pixeltris commented May 22, 2019

Afterwards i have to reset YGO_Data.toc and YGO_Data.dat to get my game running again.

This tool shouldn't modify the .dat/.toc files (unless you modified the code to do so). As I have mentioned to @SnakeDeath the tool does a lot of things to the memory of the game exe so it's quite easy to break (crash the game) with little info on what went wrong. I unfortunately do not have any suggestions for crashes (beyond what has already been mentioned here).

@SnakeDeath
Copy link

working great , ill try to update the list for the missing cards (if i found any that is)

@SnakeDeath
Copy link

SnakeDeath commented May 22, 2019

@EyderSnob i can say that the tool works on some versions of the game , the steam legit copy is one of them
also ive tried it on 2 pirated versions one of them works and the other didnt (u have to add the reg key manually so the tool can recognize where the game have been installed)

@pixeltris
Copy link
Owner

Added the missing YDK ids. The only missing ids are now tokens which you can't use in the game anyway.

Couldn't find YDK card 'Sheep Token' (3902)
Couldn't find YDK card 'Sheep Token' (3903)
Couldn't find YDK card 'Sheep Token' (3904)
Couldn't find YDK card 'Slime Token' (3907)
Couldn't find YDK card 'Ojama Token' (3915)
Couldn't find YDK card 'Ojama Token' (3916)
Couldn't find YDK card 'Lamb Token' (3918)
Couldn't find YDK card 'Fluff Token' (3925)
Couldn't find YDK card 'Maize Token' (3966)
Couldn't find YDK card 'Umbral Horror Mirage Token' (3980)
Couldn't find YDK card 'Kagemusha Raccoon Token' (3981)
Couldn't find YDK card 'Manipulator Token' (3984)
Couldn't find YDK card 'Dragon Lord Token' (3995)
Failed to find 13 YDK card ids

@SnakeDeath
Copy link

@pixeltris perfect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants