Github Locale Emulator

0 views
Skip to first unread message

Jason

unread,
Aug 5, 2024, 2:13:56 AM8/5/24
to pacvenepe
Sofar, DxWnd integrates a good part of the tricks implemented in Ntlea locale emulator, reaching a good level of compatibility, though not 100%.

But we met a strange case, "SDS Star Divers" (see =1#5ee8 ), a Japanese game that neither DxWnd nor ntlea seem able to handle properly, while another more recent locale emulator (guess what? named "Locale emulator") can do it easily.

Luckily this is a GitHub open-source project developed by Xupefei (at least, his name is quoted as "project maintainer") so the natural first step was to try to ask permission to copy his ideas and get some support. Unfortunately, the Github pages don't offer the possibility to contact him (though I am registered as a Github user ghotik2002) so I wasn't able to ask, but if he reads this page he is prayed to contact me and talk about it.


About the technicalities, it seems that Locale Emulator (from now, LE for brevity) is based on a different concept of ntlea, it seems based on faking the value of locale registry entries directly from the system registry. The idea is not new, DxWnd applied this when faking some DirectDraw capabilities, so I hope it will be possible to replicate it with no big effort, but we will see.

Browsing the LE source code, here is some code that matches the idea:


Interesting test: taking advantage of the available source code, I tried to build a LEPROC.exe release without the registry settings, hoping to break the toy. Instead LEPROC keeps working perfectly. By the way, I also used DxWnd hot registry hooking to list all the hooked registry keys, and none of the LE keys appear in the listing.

So, so much for my theories, LE works but because of something that IS NOT the registry patching!

The hunt continues ...


Two important discoveries:

1) the LE project is not fully open source? There are two required dlls (LoaderDLL.dll and LocaleEmulator.Dll) that are not built from the project solution. This could kill the possibility to replicate the LE logic.

2) The success of LE with "SDS Star Divers" depends on the assignment of two program variables: AnsiCodePage and OEMCodePage. Maybe this could give us a clue to replicate the mechanism anyway.


What's wrong is that the program was supposed to print a sequence of UTF8 Shift-Jis characters whose length can be typically 2 or more bytes, while here each print is made for a single character.

My guess is that the game has a text to print to screen and does that printing one character at a time, but it fails the operation of splitting the byte array in printable characters, doing the operation like in Default ANSI text, 1 byte per character.


Uhmm... I cried victory a little too early. There are differences in the text processing curiously for western characters. It will take some more work ...

Here are the differences:

1) the acronym "G.U.L.F." is not correct in the DxWnd processed screen

2) the font style is bolder


Wow! It's true!! This will give us a complete view of the LE insides, and also could provide some smart trick to implement a better dll injection! It's a huge work of reading and understanding, so the effects won't be soon, but this is extremely interesting. Many thanks, I completely overlooked this part of the project.


As a refresher, OmegaTrade is a stock ticker visualization application that stores stock prices in Cloud Spanner and renders visualizations using Google Charts. It consists of a frontend service that renders the visualizations and a backend service that writes to and reads from the Cloud Spanner instance.


The steps for all of the CI/CD tools we discuss are similar. The code is stored in a public GitHub repository, Docker files are used for creating the application docker image, Google Container Registry is used as the docker image repository and gcloud commands are used for application deployment to Cloud Run.


The main branch keeps the application code to be deployed on the dev environment where we will be deploying the Cloud Spanner emulator. Since it is using the emulator, we are calling this a dev environment.


We have two dockerfiles, one for dev (dockerfile.local.emulator) where we will be deploying the Cloud Spanner emulator, and another for prod (dockerfile.prod). dockerfile.local.emulator contains the Cloud Spanner emulator as well as the application layers (for testing purposes) whereas dockerfile.prod only contains the application code layer.


To set up CI/CD with Cloud Build, please ensure the Cloud Build API is enabled from your Cloud Console as a prerequisite. The first step is to connect our GitHub repository with Cloud Build for automated deployment of our application over Cloud Run.


For this blog, we are going to create 2 triggers, one dedicated to dev deployment and another to prod. The Dev deployment will be communicating with the Spanner emulator whereas Prod one will be communicating with an actual Cloud Spanner instance.


We are using the Cloud Build.yaml file (build config file) for the deployment. A build config file defines the fields that are needed for Cloud Build to perform your tasks. We can create either a .yml or .json file for Cloud Build where we write instructions for our CI/CD pipeline.


The Cloud Build config is purely parameterized which means we are using the same build config file for our frontend as well as backend deployment and providing values while creating triggers in the GCP UI.


To set up Jenkins CI/CD, we are using the Jenkins Multibranch Pipeline, which allows for creating and triggering pipelines based on branch and pull requests. For this blog post, we are going to create 2 branches: dev and prod. Dev app code will be communicating with the Spanner emulator hosted on Google Compute Engine whereas the Prod one would be communicating with an actual Cloud Spanner instance.


Integrating Jenkins with GitHub keeps your project updated. With this, your Jenkins build will automatically schedule when there is any new push/commit to the branch by pulling the code and data files from GitHub to Jenkins.


Credentials allow Jenkins to interact with 3rd party services or tools like Docker Container Registry in an authorized manner. Jenkins stores credentials in encrypted form on the master Jenkins instance (encrypted by the Jenkins instance ID) and the credentials are only handled in Pipeline projects via their credential IDs.


If you have the code for more than one service in a single repo, then creating a repo-based trigger is not recommended, because all the pipelines will get triggered by any change in the repo. With this plugin, however, you can specify folders from which a build will occur. Like in the above example, this particular pipeline will only get triggered when there is a change in the specific folder.


Leave the rest of the options as it is and hit Save. As you save it, Jenkins will scan the repository and display logs. Once it is done, Jenkins will start building and deploying the app over GCP Cloud Run.


From the GitHub repo, go to Actions, where you will find the pre-created workflows. Choose any of them, clear all the code from there, paste the Workflow code and name the file. As you commit that, you will see a .github/workflows folder appear in the GitHub repository.


The GitHub Actions workflows are branch and folder-specific as we have mentioned the keywords push for branch and working-directory for folder. The commit needs to satisfy these 2 things to run a specific workflow.


We are using previously created GitHub Actions for configuring the Google Cloud SDK in the GitHub Actions environment and here we are passing Service account and SA keys for authorization. Once authorization is done, we are building, tagging, and pushing docker images to GCR and deploying applications over Cloud Run.


For CircleCI integration, you need to have an account on CircleCI and add your GitHub Repository as a project in CircleCI. Once this is done, CircleCI will take care of deployments of your app on GCP Cloud Run.


Once you add a project, CircleCI will ask you to write and commit config.yml to your GitHub repository. There are templates already present for different languages and frameworks. You can ignore these right now and follow the CircleCI Pipeline Code. You can just paste it and commit it.


This pipeline has 2 jobs, one for dockerizing and deploying apps in the dev environment, and another one for the prod environment. The pipeline for the Dev environment will run when there is a change or commit in the main branch whereas the one for the prod environment will run when there is a change or commit in the prod branch.


SE2: Software Design and Architecture is the second course of the three software engineering capstone project courses, offered jointly by the David R. Cheriton School of Computer Science and the Department of Electrical and Computer Engineering at the University of Waterloo.


Recorded lectures, slides and the the notes will be posted in Learn on Monday and Wednesday by 10 AM (I will strive to upload them even before but if you look into Learn by 10 AM on Mon/Wed you should be able to see them).




Official administrative entry and outline.


Important dates and information will be posted here on this website. The official syllabus is also the contents on this website. You can reach this website from the corresponding entry in learn.uwaterloo.ca.


All TAs will be answering questions mostly only on Learn. If there is a specific need to actually talk to a TA, please email them to get a virtual meeting link that can be used. They have preferred times set up (below). Please try to schedule during these times as much as possible.


The project forms an integral part of this course. Here are some of the hard requirements: The app should be implemented as a Native Android app (i.e., not built using an app builder or a framework like React/Node.js or HTML5). The code should be hosted in Github as a private repository. You can choose to open source it after the class if you want. But during the time of the class it shall be private. You will need to add the following user as a collaborator with full privileges: uw-cs446-s21. This is github account for the instructor and TA. The app should use at least 2 architectural styles and 2 design patterns that have been discussed in class.

3a8082e126
Reply all
Reply to author
Forward
0 new messages