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

Upgrade MobileUO to CUO version 0.1.9.0 #28

Open
wants to merge 54 commits into
base: master
Choose a base branch
from

Conversation

mandlar
Copy link
Contributor

@mandlar mandlar commented Jan 13, 2025

#24

This PR is bringing CUO up to version 0.1.9.0. This build seems stable in both Unity Player and my Android phone from my testing. Again, there could be issues that I haven't noticed.

Changes since 0.1.8.0 PR:

  • Still flagging all changes from CUO with // MobileUO: comments
  • Updated shader file. Please double check it, but I believe I migrated it correctly from the .fx file changes. I had to add a Brightlight variable to be passed in.
  • There's a few rendering/graphics places that were trying to use SDL_CreateRGBSurfaceWithFormatFrom which doesn't exist in our version of XNA, so I reverted them to the previously working logic. Similarly with GetData from XNA's Texture2D class.
  • There's new PixelCheck methods that uses a new PixelPicker class. I reverted to using the old Texture.Contains()/GetDataAtPos() logic for Pixel Checks until this logic can be merged into PixelPicker. I left a TODO marker for it.
  • I backported one 0.1.10.0 fix for bringing gumps to the top to fix an issue with the radar mini map and world map gumps
  • MP3Sharp was removed from the project and added as an external git submodule. I put it in Assets/Scripts/MP3Sharp so that Unity will pick it up and not have to symlink the files.
  • Sound.cs now is throwing an exception when I try to set the volume to 0. It wasn't doing it previously. I just commented out with a TODO stub for now. Error is UnityException: set_volume can only be called from the main thread.. It wasn't doing this on the last version, so not sure what changed here unless it was because of the MP3Sharp changes.
  • I stubbed out with a TODO marker the UOFileManager changes for iOS filesystem. I currently don't have a Mac to compile and test on my iPhone; I'll re-visit it later in latest CUO version if needed.
  • Kept old Packet classes only for Assistant. I left TODO markers that the Assistant should be re-written to remove the dependency on these old versions.
  • I added the NugetForUnity package so that we could add the System.Runtime.CompilerServices.Unsafe Nuget package that CUO added

Those should be the high level notable changes. Everything else was just core CUO changes.

new rendering method does not work correctly, but reverted to old method via _use_render_target flag
…builds the dll into the Unity assets folder in order to get these files working inside of Unity. The files are still symlinked to the original ones.
…t the old version of ScrollArea control into the assistant so that it would only affect the assistant and not everywhere else. The more optimal solution is to re-write the assistant with the new ScrollArea behavior
mandlar added 14 commits January 7, 2025 21:32
…playing the same (incorrect) song everywhere in both Unity player and Android. Will re-visit later with CUO uprades
…hods. Reverted to using old pixel checks for now. Also fixed issue with GumpsLoader getting textures which was breaking mini map radar and maybe other gumps.
…ssues with world map gump, options gump and assistant gump
… not moving on top of other gumps. It's a backported fix from CUO 0.1.10.0
…own texture downstream for handle the Unity pixel check correctly
@VoxelBoy
Copy link
Owner

I'm trying to check out your PR on my Windows machine but running into problems with symlinks and MP3Sharp submodule. Are you also working on the changes on Windows? Or some other OS?
I think I can fix the symlinks on my end but somehow the MP3Sharp submodule shows this error when trying to open or update it:
error: pathspec 'Assets/Scripts/MP3Sharp' did not match any file(s) known to git

Any ideas?

@mandlar
Copy link
Contributor Author

mandlar commented Jan 15, 2025

@VoxelBoy

I'm pushing one commit that I think will fix the MP3Sharp repo. Here's all the instructions for getting set up:

First setup symlinks:

  • Re-installed latest Git for Windows and made sure to enable symbolic links
  • Add permission to your user to be able to create symlinks via GPO: https://stackoverflow.com/questions/5917249/git-symbolic-links-in-windows/59761201#comment130689929_59761201
  • I made sure symlinks were enable for the git repo git config core.symlinks true
  • I ran Visual Studio as an admin (appears to be required to make the symlinks work). I switched to a test branch and back to master and they were there and working. Should also work with git bash, just make sure you run as admin

Pulling the branch:

  • Open VS, run as admin
  • Clone a repository: https://github.com/mandlar/MobileUO.git
  • switch to branch: tags/0.1.9.0
  • git submodule init
  • git submodule update
  • if for some reason MP3Sharp still doesn't show up, add it yourself: git submodule add https://github.com/andreakarasho/MP3Sharp.git Assets/Scripts/MP3Sharp
  • Add the project into Unity Hub
  • Open the project in Unity
  • Unity will now create a .sln file so that you can also open the project inside of Visual Studio (if you so choose. I've been using VS 99% of the time with this project)
  • TEMP FIX: delete MP3Sharp.UnitTests and XNA4Sample folders inside of the Assets/Scripts/MP3Sharp/ folder. I'll either symlink everything or fork the MP3Sharp repo and remove these from it or do something else to fix this. I apparently forgot I did this previously. I was originally trying to avoid having to symlink the files from this repo, but it looks like I might just have to unless there's a way to ignore a subdirectory with a submodule.

…d no longer needed PixelCheck flag. Reverted to new implementations that use Texture2D's SetDataPointerEXT and GetData now that these functions are implemented in the Unity XNA wrapper
Refactoring to use original XNA SetDataPointerEXT() and GetData()
@mandlar
Copy link
Contributor Author

mandlar commented Jan 15, 2025

@VoxelBoy just FYI, I merged a PR into this branch

I came up with implementations for the missing SetDataPointerEXT() and GetData() functions in Texture2D so I could use the original CUO code instead of hacking together the older implementations that I was still using.

@mandlar
Copy link
Contributor Author

mandlar commented Jan 16, 2025

@VoxelBoy made one more PR into this to fix the issues with MP3Sharp

I had issues doing a directory symlink; Unity was stuck in an infinite import loop. So I moved the submodule to /external/ directory and just manually copied the MP3Sharp directory into Assets/Scripts/. Maybe later I'll symlink each individual file since that method does work for CUO

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

Successfully merging this pull request may close these issues.

2 participants