early-access version 4065
This commit is contained in:
parent
b820406e60
commit
25a5c6d8ca
8 changed files with 56 additions and 69 deletions
|
@ -1,7 +1,7 @@
|
||||||
yuzu emulator early access
|
yuzu emulator early access
|
||||||
=============
|
=============
|
||||||
|
|
||||||
This is the source code for early-access 4064.
|
This is the source code for early-access 4065.
|
||||||
|
|
||||||
## Legal Notice
|
## Legal Notice
|
||||||
|
|
||||||
|
|
|
@ -188,8 +188,15 @@ tasks.create<Delete>("ktlintReset") {
|
||||||
delete(File(buildDir.path + File.separator + "intermediates/ktLint"))
|
delete(File(buildDir.path + File.separator + "intermediates/ktLint"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val showFormatHelp = {
|
||||||
|
logger.lifecycle(
|
||||||
|
"If this check fails, please try running \"gradlew ktlintFormat\" for automatic " +
|
||||||
|
"codestyle fixes"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
tasks.getByPath("ktlintKotlinScriptCheck").doFirst { showFormatHelp.invoke() }
|
||||||
|
tasks.getByPath("ktlintMainSourceSetCheck").doFirst { showFormatHelp.invoke() }
|
||||||
tasks.getByPath("loadKtlintReporters").dependsOn("ktlintReset")
|
tasks.getByPath("loadKtlintReporters").dependsOn("ktlintReset")
|
||||||
tasks.getByPath("preBuild").dependsOn("ktlintCheck")
|
|
||||||
|
|
||||||
ktlint {
|
ktlint {
|
||||||
version.set("0.47.1")
|
version.set("0.47.1")
|
||||||
|
@ -228,71 +235,33 @@ dependencies {
|
||||||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.0")
|
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.0")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getGitVersion(): String {
|
fun runGitCommand(command: List<String>): String {
|
||||||
var versionName = "0.0"
|
return try {
|
||||||
|
ProcessBuilder(command)
|
||||||
try {
|
|
||||||
versionName = ProcessBuilder("git", "describe", "--always", "--long")
|
|
||||||
.directory(project.rootDir)
|
.directory(project.rootDir)
|
||||||
.redirectOutput(ProcessBuilder.Redirect.PIPE)
|
.redirectOutput(ProcessBuilder.Redirect.PIPE)
|
||||||
.redirectError(ProcessBuilder.Redirect.PIPE)
|
.redirectError(ProcessBuilder.Redirect.PIPE)
|
||||||
.start().inputStream.bufferedReader().use { it.readText() }
|
.start().inputStream.bufferedReader().use { it.readText() }
|
||||||
.trim()
|
.trim()
|
||||||
|
} catch (e: Exception) {
|
||||||
|
logger.error("Cannot find git")
|
||||||
|
""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getGitVersion(): String {
|
||||||
|
val versionName = if (System.getenv("GITHUB_ACTIONS") != null) {
|
||||||
|
val gitTag = System.getenv("GIT_TAG_NAME") ?: ""
|
||||||
|
gitTag
|
||||||
|
} else {
|
||||||
|
runGitCommand(listOf("git", "describe", "--always", "--long"))
|
||||||
.replace(Regex("(-0)?-[^-]+$"), "")
|
.replace(Regex("(-0)?-[^-]+$"), "")
|
||||||
} catch (e: Exception) {
|
|
||||||
logger.error("Cannot find git, defaulting to dummy version number")
|
|
||||||
}
|
}
|
||||||
|
return versionName.ifEmpty { "0.0" }
|
||||||
if (System.getenv("GITHUB_ACTIONS") != null) {
|
|
||||||
val gitTag = System.getenv("GIT_TAG_NAME")
|
|
||||||
versionName = gitTag ?: versionName
|
|
||||||
}
|
|
||||||
|
|
||||||
return versionName
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getGitHash(): String {
|
fun getGitHash(): String =
|
||||||
try {
|
runGitCommand(listOf("git", "rev-parse", "--short", "HEAD")).ifEmpty { "dummy-hash" }
|
||||||
val processBuilder = ProcessBuilder("git", "rev-parse", "--short", "HEAD")
|
|
||||||
processBuilder.directory(project.rootDir)
|
|
||||||
val process = processBuilder.start()
|
|
||||||
val inputStream = process.inputStream
|
|
||||||
val errorStream = process.errorStream
|
|
||||||
process.waitFor()
|
|
||||||
|
|
||||||
return if (process.exitValue() == 0) {
|
fun getBranch(): String =
|
||||||
inputStream.bufferedReader()
|
runGitCommand(listOf("git", "rev-parse", "--abbrev-ref", "HEAD")).ifEmpty { "dummy-hash" }
|
||||||
.use { it.readText().trim() } // return the value of gitHash
|
|
||||||
} else {
|
|
||||||
val errorMessage = errorStream.bufferedReader().use { it.readText().trim() }
|
|
||||||
logger.error("Error running git command: $errorMessage")
|
|
||||||
"dummy-hash" // return a dummy hash value in case of an error
|
|
||||||
}
|
|
||||||
} catch (e: Exception) {
|
|
||||||
logger.error("$e: Cannot find git, defaulting to dummy build hash")
|
|
||||||
return "dummy-hash" // return a dummy hash value in case of an error
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getBranch(): String {
|
|
||||||
try {
|
|
||||||
val processBuilder = ProcessBuilder("git", "rev-parse", "--abbrev-ref", "HEAD")
|
|
||||||
processBuilder.directory(project.rootDir)
|
|
||||||
val process = processBuilder.start()
|
|
||||||
val inputStream = process.inputStream
|
|
||||||
val errorStream = process.errorStream
|
|
||||||
process.waitFor()
|
|
||||||
|
|
||||||
return if (process.exitValue() == 0) {
|
|
||||||
inputStream.bufferedReader()
|
|
||||||
.use { it.readText().trim() } // return the value of gitHash
|
|
||||||
} else {
|
|
||||||
val errorMessage = errorStream.bufferedReader().use { it.readText().trim() }
|
|
||||||
logger.error("Error running git command: $errorMessage")
|
|
||||||
"dummy-hash" // return a dummy hash value in case of an error
|
|
||||||
}
|
|
||||||
} catch (e: Exception) {
|
|
||||||
logger.error("$e: Cannot find git, defaulting to dummy build hash")
|
|
||||||
return "dummy-hash" // return a dummy hash value in case of an error
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -76,8 +76,8 @@ class AboutFragment : Fragment() {
|
||||||
binding.root.findNavController().navigate(R.id.action_aboutFragment_to_licensesFragment)
|
binding.root.findNavController().navigate(R.id.action_aboutFragment_to_licensesFragment)
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.textBuildHash.text = BuildConfig.GIT_HASH
|
binding.textVersionName.text = BuildConfig.VERSION_NAME
|
||||||
binding.buttonBuildHash.setOnClickListener {
|
binding.textVersionName.setOnClickListener {
|
||||||
val clipBoard =
|
val clipBoard =
|
||||||
requireContext().getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
requireContext().getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
||||||
val clip = ClipData.newPlainText(getString(R.string.build), BuildConfig.GIT_HASH)
|
val clip = ClipData.newPlainText(getString(R.string.build), BuildConfig.GIT_HASH)
|
||||||
|
|
|
@ -147,7 +147,7 @@
|
||||||
android:layout_marginHorizontal="20dp" />
|
android:layout_marginHorizontal="20dp" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/button_build_hash"
|
android:id="@+id/button_version_name"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/selectableItemBackground"
|
android:background="?attr/selectableItemBackground"
|
||||||
|
@ -164,7 +164,7 @@
|
||||||
android:textAlignment="viewStart" />
|
android:textAlignment="viewStart" />
|
||||||
|
|
||||||
<com.google.android.material.textview.MaterialTextView
|
<com.google.android.material.textview.MaterialTextView
|
||||||
android:id="@+id/text_build_hash"
|
android:id="@+id/text_version_name"
|
||||||
style="@style/TextAppearance.Material3.BodyMedium"
|
style="@style/TextAppearance.Material3.BodyMedium"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
|
@ -148,7 +148,7 @@
|
||||||
android:layout_marginHorizontal="20dp" />
|
android:layout_marginHorizontal="20dp" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/button_build_hash"
|
android:id="@+id/button_version_name"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingVertical="16dp"
|
android:paddingVertical="16dp"
|
||||||
|
@ -165,7 +165,7 @@
|
||||||
android:text="@string/build" />
|
android:text="@string/build" />
|
||||||
|
|
||||||
<com.google.android.material.textview.MaterialTextView
|
<com.google.android.material.textview.MaterialTextView
|
||||||
android:id="@+id/text_build_hash"
|
android:id="@+id/text_version_name"
|
||||||
style="@style/TextAppearance.Material3.BodyMedium"
|
style="@style/TextAppearance.Material3.BodyMedium"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
|
@ -61,9 +61,7 @@ ProfileManager::ProfileManager() {
|
||||||
OpenUser(*GetUser(current));
|
OpenUser(*GetUser(current));
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfileManager::~ProfileManager() {
|
ProfileManager::~ProfileManager() = default;
|
||||||
WriteUserSaveFile();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// After a users creation it needs to be "registered" to the system. AddToProfiles handles the
|
/// After a users creation it needs to be "registered" to the system. AddToProfiles handles the
|
||||||
/// internal management of the users profiles
|
/// internal management of the users profiles
|
||||||
|
@ -113,6 +111,8 @@ Result ProfileManager::CreateNewUser(UUID uuid, const ProfileUsername& username)
|
||||||
return ERROR_USER_ALREADY_EXISTS;
|
return ERROR_USER_ALREADY_EXISTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is_save_needed = true;
|
||||||
|
|
||||||
return AddUser({
|
return AddUser({
|
||||||
.user_uuid = uuid,
|
.user_uuid = uuid,
|
||||||
.username = username,
|
.username = username,
|
||||||
|
@ -326,6 +326,9 @@ bool ProfileManager::RemoveUser(UUID uuid) {
|
||||||
profiles[*index] = ProfileInfo{};
|
profiles[*index] = ProfileInfo{};
|
||||||
std::stable_partition(profiles.begin(), profiles.end(),
|
std::stable_partition(profiles.begin(), profiles.end(),
|
||||||
[](const ProfileInfo& profile) { return profile.user_uuid.IsValid(); });
|
[](const ProfileInfo& profile) { return profile.user_uuid.IsValid(); });
|
||||||
|
|
||||||
|
is_save_needed = true;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -340,6 +343,8 @@ bool ProfileManager::SetProfileBase(UUID uuid, const ProfileBase& profile_new) {
|
||||||
profile.username = profile_new.username;
|
profile.username = profile_new.username;
|
||||||
profile.creation_time = profile_new.timestamp;
|
profile.creation_time = profile_new.timestamp;
|
||||||
|
|
||||||
|
is_save_needed = true;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -348,6 +353,7 @@ bool ProfileManager::SetProfileBaseAndData(Common::UUID uuid, const ProfileBase&
|
||||||
const auto index = GetUserIndex(uuid);
|
const auto index = GetUserIndex(uuid);
|
||||||
if (index.has_value() && SetProfileBase(uuid, profile_new)) {
|
if (index.has_value() && SetProfileBase(uuid, profile_new)) {
|
||||||
profiles[*index].data = data_new;
|
profiles[*index].data = data_new;
|
||||||
|
is_save_needed = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,6 +397,10 @@ void ProfileManager::ParseUserSaveFile() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProfileManager::WriteUserSaveFile() {
|
void ProfileManager::WriteUserSaveFile() {
|
||||||
|
if (!is_save_needed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ProfileDataRaw raw{};
|
ProfileDataRaw raw{};
|
||||||
|
|
||||||
for (std::size_t i = 0; i < MAX_USERS; ++i) {
|
for (std::size_t i = 0; i < MAX_USERS; ++i) {
|
||||||
|
@ -423,7 +433,10 @@ void ProfileManager::WriteUserSaveFile() {
|
||||||
if (!save.IsOpen() || !save.SetSize(sizeof(ProfileDataRaw)) || !save.WriteObject(raw)) {
|
if (!save.IsOpen() || !save.SetSize(sizeof(ProfileDataRaw)) || !save.WriteObject(raw)) {
|
||||||
LOG_WARNING(Service_ACC, "Failed to write save data to file... No changes to user data "
|
LOG_WARNING(Service_ACC, "Failed to write save data to file... No changes to user data "
|
||||||
"made in current session will be saved.");
|
"made in current session will be saved.");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is_save_needed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}; // namespace Service::Account
|
}; // namespace Service::Account
|
||||||
|
|
|
@ -103,6 +103,7 @@ private:
|
||||||
std::optional<std::size_t> AddToProfiles(const ProfileInfo& profile);
|
std::optional<std::size_t> AddToProfiles(const ProfileInfo& profile);
|
||||||
bool RemoveProfileAtIndex(std::size_t index);
|
bool RemoveProfileAtIndex(std::size_t index);
|
||||||
|
|
||||||
|
bool is_save_needed{};
|
||||||
std::array<ProfileInfo, MAX_USERS> profiles{};
|
std::array<ProfileInfo, MAX_USERS> profiles{};
|
||||||
std::array<ProfileInfo, MAX_USERS> stored_opened_profiles{};
|
std::array<ProfileInfo, MAX_USERS> stored_opened_profiles{};
|
||||||
std::size_t user_count{};
|
std::size_t user_count{};
|
||||||
|
|
|
@ -205,6 +205,7 @@ void ConfigureProfileManager::AddUser() {
|
||||||
|
|
||||||
const auto uuid = Common::UUID::MakeRandom();
|
const auto uuid = Common::UUID::MakeRandom();
|
||||||
profile_manager.CreateNewUser(uuid, username.toStdString());
|
profile_manager.CreateNewUser(uuid, username.toStdString());
|
||||||
|
profile_manager.WriteUserSaveFile();
|
||||||
|
|
||||||
item_model->appendRow(new QStandardItem{GetIcon(uuid), FormatUserEntryText(username, uuid)});
|
item_model->appendRow(new QStandardItem{GetIcon(uuid), FormatUserEntryText(username, uuid)});
|
||||||
}
|
}
|
||||||
|
@ -228,6 +229,7 @@ void ConfigureProfileManager::RenameUser() {
|
||||||
std::copy(username_std.begin(), username_std.end(), profile.username.begin());
|
std::copy(username_std.begin(), username_std.end(), profile.username.begin());
|
||||||
|
|
||||||
profile_manager.SetProfileBase(*uuid, profile);
|
profile_manager.SetProfileBase(*uuid, profile);
|
||||||
|
profile_manager.WriteUserSaveFile();
|
||||||
|
|
||||||
item_model->setItem(
|
item_model->setItem(
|
||||||
user, 0,
|
user, 0,
|
||||||
|
@ -256,6 +258,8 @@ void ConfigureProfileManager::DeleteUser(const Common::UUID& uuid) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
profile_manager.WriteUserSaveFile();
|
||||||
|
|
||||||
item_model->removeRows(tree_view->currentIndex().row(), 1);
|
item_model->removeRows(tree_view->currentIndex().row(), 1);
|
||||||
tree_view->clearSelection();
|
tree_view->clearSelection();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue