Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/codeql/codeql-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,18 @@ paths-ignore:
# Query configuration
queries:
- uses: security-and-quality

# Exclude rules that are intentional design decisions for this project
query-filters:
# Generic catch clauses are intentional for crash prevention in game framework
- exclude:
id: cs/catch-of-all-exceptions
# Nested if-statements are acceptable code style
- exclude:
id: cs/nested-if-statements
# Complex blocks are acceptable for algorithm implementations
- exclude:
id: cs/complex-block
# Project intentionally avoids LINQ for performance
- exclude:
id: cs/linq/missed-where
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
uses: github/codeql-action/init@v4
with:
languages: csharp
config-file: ./.github/codeql/codeql-config.yml
Expand All @@ -47,6 +47,6 @@ jobs:
build-mode: none

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
uses: github/codeql-action/analyze@v4
with:
category: "/language:csharp"
3 changes: 3 additions & 0 deletions .github/workflows/dco-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
pull_request:
branches: [master]

permissions:
contents: read

jobs:
dco-check:
name: Verify DCO Sign-off
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/pr-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ concurrency:
group: pr-tests-${{ github.event.pull_request.number }}
cancel-in-progress: true

permissions:
contents: read
pull-requests: write
statuses: write

jobs:
run-tests:
name: Run Unity Tests
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ on:
required: false
type: string

permissions:
contents: write

jobs:
validate:
name: Validate Inputs
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/unity-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ on:
description: 'Test results summary'
value: ${{ jobs.test.outputs.results }}

permissions:
contents: read
checks: write

jobs:
test:
name: Run Unity Tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,14 +259,7 @@ private void ExecuteCurrentStep()

Log("Code build completed successfully!");

if (_buildAll)
{
_currentStep = BuildStep.BuildAssets;
}
else
{
_currentStep = BuildStep.Complete;
}
_currentStep = _buildAll ? BuildStep.BuildAssets : BuildStep.Complete;
break;

case BuildStep.BuildAssets:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,17 +428,17 @@ public static string ByteArrayToHex(SerializedProperty property)
if (property.arraySize == 0)
return "Empty";

var hex = "";
var hex = new System.Text.StringBuilder();
for (int i = 0; i < property.arraySize; i++)
{
if (i > 0 && i % 16 == 0)
hex += "\n";
hex.Append('\n');
else if (i > 0)
hex += " ";
hex.Append(' ');

hex += property.GetArrayElementAtIndex(i).intValue.ToString("X2");
hex.Append(property.GetArrayElementAtIndex(i).intValue.ToString("X2"));
}
return hex;
return hex.ToString();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,11 @@ public static VisualElement CreatePackageSettingsGroup(Settings settings)
var buildTargetField = new EnumField(settings.buildTarget);
buildTargetField.RegisterValueChangedCallback(evt =>
{
settings.buildTarget = (BuildTarget)evt.newValue;
settings.Save();
if (evt.newValue is BuildTarget newTarget)
{
settings.buildTarget = newTarget;
settings.Save();
}
});
buildTargetField.AddToClassList("form-control");
EditorUIUtils.MakeTextResponsive(buildTargetField);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ public static string GetPlatform()
}

private static Bootstrap _instance;
private static void SetInstance(Bootstrap instance) => _instance = instance;

[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterAssembliesLoaded)]
private static void SetUpStaticSecretKey()
Expand All @@ -141,7 +142,7 @@ private async UniTask SetUpDynamicSecret()
Debug.Log("SetUpDynamicSecret begin");
var handle = YooAssets.LoadAssetAsync<TextAsset>(dynamicSecretKeyPath);
await handle.Task;
TextAsset dynamicSecretKeyAsset = (TextAsset)handle.AssetObject;
TextAsset dynamicSecretKeyAsset = handle.GetAssetObject<TextAsset>();
EncryptionService<DefaultDynamicEncryptionScope>.Encryptor =
new GeneratedEncryptionVirtualMachine(dynamicSecretKeyAsset.bytes);
handle.Release();
Expand All @@ -153,7 +154,7 @@ private async UniTask LoadMetadataForAOTAssemblies()
{
var aotListHandle = YooAssets.LoadAssetAsync<TextAsset>(aotDllListFilePath);
await aotListHandle.Task;
TextAsset aotDataAsset = (TextAsset)aotListHandle.AssetObject;
TextAsset aotDataAsset = aotListHandle.GetAssetObject<TextAsset>();
var aotDllList = NinoDeserializer.Deserialize<List<string>>(aotDataAsset.bytes);
aotListHandle.Release();

Expand All @@ -167,7 +168,7 @@ private async UniTask LoadMetadataForAOTAssemblies()

var handle = YooAssets.LoadAssetAsync<TextAsset>(aotDllName);
await handle.Task;
byte[] dllBytes = ((TextAsset)handle.AssetObject).bytes;
byte[] dllBytes = handle.GetAssetObject<TextAsset>().bytes;
var err = RuntimeApi.LoadMetadataForAOTAssembly(dllBytes, HomologousImageMode.SuperSet);
Debug.Log($"LoadMetadataForAOTAssembly:{aotDllName}. ret:{err}");
handle.Release();
Expand All @@ -181,7 +182,7 @@ private void Awake()
DestroyImmediate(_instance);
}

_instance = this;
SetInstance(this);
DontDestroyOnLoad(gameObject);

startButton?.gameObject.SetActive(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static T Instance
{
if (_instance == null)
{
const string path = "EncryptConfigs/";
const string path = "EncryptConfigs";
_instance = Resources.Load<T>(Path.Combine(path, typeof(T).Name));
if (_instance == null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ public static byte[] GenerateRandomBytes(int length)
return bytes;
}

/// <summary>
/// Check if byte array is null or contains only zeros.
/// Using foreach for performance (no LINQ allocation).
/// </summary>
public static bool IsEmpty(byte[] array)
{
if (array == null) return true;
Expand Down