From b2b736abc2569ab5d8199da666aef8d8394844a0 Mon Sep 17 00:00:00 2001 From: Alex Barney Date: Mon, 1 Jul 2019 21:39:22 -0500 Subject: [PATCH] Misc cleanup (#708) * Fix typos * Remove unneeded using statements * Enforce var style more * Remove redundant qualifiers * Fix some indentation * Disable naming warnings on files with external enum names * Fix build * Mass find & replace for comments with no spacing * Standardize todo capitalization and for/if spacing --- ChocolArm64/Decoders/Condition.cs | 4 +- ChocolArm64/Decoders/Decoder.cs | 52 ++--- ChocolArm64/Decoders/OpCode32.cs | 4 +- ChocolArm64/Decoders/OpCode32BImm.cs | 2 +- ChocolArm64/Decoders/OpCodeMemImm64.cs | 12 +- ChocolArm64/Decoders/OpCodeSimdImm64.cs | 18 +- ChocolArm64/Instructions/InstEmit32Helper.cs | 2 +- ChocolArm64/Instructions/InstEmitAlu.cs | 14 +- ChocolArm64/Instructions/InstEmitAlu32.cs | 2 +- ChocolArm64/Instructions/InstEmitAluHelper.cs | 20 +- ChocolArm64/Instructions/InstEmitBfm.cs | 4 +- ChocolArm64/Instructions/InstEmitException.cs | 4 +- ChocolArm64/Instructions/InstEmitFlow32.cs | 4 +- .../Instructions/InstEmitFlowHelper.cs | 16 +- ChocolArm64/Instructions/InstEmitMemory.cs | 8 +- ChocolArm64/Instructions/InstEmitMemory32.cs | 22 +- ChocolArm64/Instructions/InstEmitMemoryEx.cs | 42 ++-- .../Instructions/InstEmitMemoryHelper.cs | 6 +- .../Instructions/InstEmitSimdHelper.cs | 4 +- .../Instructions/InstEmitSimdMemory.cs | 2 +- ChocolArm64/Instructions/InstEmitSystem.cs | 16 +- ChocolArm64/Instructions/VectorHelper.cs | 8 +- ChocolArm64/Memory/MemoryManagement.cs | 6 +- ChocolArm64/Memory/MemoryManagementUnix.cs | 14 +- ChocolArm64/Memory/MemoryManager.cs | 26 +-- ChocolArm64/OpCodeTable.cs | 18 +- ChocolArm64/State/CpuThreadState.cs | 4 +- ChocolArm64/Translation/ILEmitterCtx.cs | 50 ++--- ChocolArm64/Translation/RegisterUsage.cs | 4 +- ChocolArm64/Translation/TranslatedSub.cs | 12 +- ChocolArm64/Translation/Translator.cs | 10 +- ChocolArm64/Translation/TranslatorCache.cs | 14 +- Ryujinx.Audio/Renderers/DummyAudioOut.cs | 4 +- .../Renderers/OpenAL/OpenALAudioOut.cs | 10 +- .../Renderers/SoundIo/SoundIoAudioOut.cs | 18 +- .../SoundIo/SoundIoAudioTrackPool.cs | 2 +- Ryujinx.Common/Logging/LogEventArgs.cs | 18 +- Ryujinx.Common/Pools/ObjectPool.cs | 8 +- Ryujinx.Graphics/DmaPusher.cs | 12 +- Ryujinx.Graphics/Gal/GalImageFormat.cs | 3 +- Ryujinx.Graphics/Gal/GalVertexBinding.cs | 2 +- .../Gal/OpenGL/OglEnumConverter.cs | 4 +- Ryujinx.Graphics/Gal/OpenGL/OglPipeline.cs | 8 +- .../Gal/OpenGL/OglRenderTarget.cs | 12 +- Ryujinx.Graphics/Gal/OpenGL/OglShader.cs | 8 +- Ryujinx.Graphics/Gal/OpenGL/OglTexture.cs | 2 +- Ryujinx.Graphics/Gal/ShaderDumper.cs | 8 +- Ryujinx.Graphics/GpuResourceManager.cs | 2 +- .../Graphics3d/MacroInterpreter.cs | 26 +-- Ryujinx.Graphics/Graphics3d/NvGpuEngine2d.cs | 8 +- Ryujinx.Graphics/Graphics3d/NvGpuEngine3d.cs | 68 +++--- .../Graphics3d/NvGpuEngineM2mf.cs | 2 +- .../Graphics3d/NvGpuEngineP2mf.cs | 2 +- Ryujinx.Graphics/Graphics3d/NvGpuFifo.cs | 4 +- .../Graphics3d/Texture/AstcDecoder.cs | 4 +- .../Graphics3d/Texture/AstcPixel.cs | 2 +- .../Graphics3d/Texture/ImageUtils.cs | 4 +- Ryujinx.Graphics/Memory/NvGpuVmm.cs | 4 +- Ryujinx.Graphics/QuadHelper.cs | 12 +- .../Shader/CodeGen/Glsl/CodeGenContext.cs | 20 +- .../Glsl/Instructions/InstGenHelper.cs | 10 +- .../Glsl/Instructions/InstGenMemory.cs | 12 +- .../CodeGen/Glsl/Instructions/InstType.cs | 10 +- .../Shader/CodeGen/Glsl/OperandManager.cs | 12 +- Ryujinx.Graphics/Shader/Decoders/Decoder.cs | 18 +- Ryujinx.Graphics/Shader/Decoders/OpCode.cs | 2 +- .../Shader/Decoders/OpCodeTextureScalar.cs | 1 + .../Shader/Instructions/InstEmitAlu.cs | 44 ++-- .../Shader/Instructions/InstEmitAluHelper.cs | 12 +- .../Shader/Instructions/InstEmitConversion.cs | 14 +- .../Shader/Instructions/InstEmitFArith.cs | 2 +- .../Shader/Instructions/InstEmitFlow.cs | 12 +- .../Shader/Instructions/InstEmitHelper.cs | 2 +- .../Shader/Instructions/InstEmitMemory.cs | 4 +- .../Shader/Instructions/InstEmitTexture.cs | 2 +- .../Shader/Instructions/Lop3Expression.cs | 16 +- .../IntermediateRepresentation/Operation.cs | 2 +- Ryujinx.Graphics/Shader/ShaderHeader.cs | 2 +- .../Shader/StructuredIr/AstBlockVisitor.cs | 6 +- .../Shader/StructuredIr/GotoElimination.cs | 48 ++--- .../Shader/StructuredIr/StructuredProgram.cs | 8 +- .../StructuredIr/StructuredProgramContext.cs | 10 +- .../Shader/Translation/AttributeConsts.cs | 4 +- .../Shader/Translation/Dominance.cs | 4 +- .../Optimizations/BranchElimination.cs | 14 +- .../Optimizations/HalfConversion.cs | 4 +- .../Translation/Optimizations/Optimizer.cs | 12 +- .../Optimizations/Simplification.cs | 22 +- Ryujinx.Graphics/Shader/Translation/Ssa.cs | 12 +- .../Shader/Translation/Translator.cs | 28 +-- Ryujinx.Graphics/VDec/H264Decoder.cs | 6 +- Ryujinx.Graphics/VDec/VideoDecoder.cs | 2 +- Ryujinx.Graphics/VDec/Vp9Decoder.cs | 20 +- .../ServiceNotImplementedException.cs | 2 - .../FileSystem/Content/ContentManager.cs | 2 +- .../HOS/Diagnostics/Demangler/Demangler.cs | 8 +- Ryujinx.HLE/HOS/Homebrew.cs | 12 +- Ryujinx.HLE/HOS/HomebrewRomFsStream.cs | 2 +- Ryujinx.HLE/HOS/Horizon.cs | 10 +- Ryujinx.HLE/HOS/Ipc/IpcHandler.cs | 4 +- Ryujinx.HLE/HOS/Ipc/IpcMessage.cs | 6 +- Ryujinx.HLE/HOS/Kernel/Common/KernelInit.cs | 6 +- .../HOS/Kernel/Common/MersenneTwister.cs | 6 +- .../HOS/Kernel/Ipc/KBufferDescriptorTable.cs | 2 +- Ryujinx.HLE/HOS/Kernel/Ipc/KClientPort.cs | 4 +- Ryujinx.HLE/HOS/Kernel/Ipc/KClientSession.cs | 4 +- Ryujinx.HLE/HOS/Kernel/Ipc/KServerSession.cs | 34 +-- .../HOS/Kernel/Memory/KMemoryManager.cs | 94 ++++----- .../HOS/Kernel/Memory/KMemoryRegionManager.cs | 26 +-- .../HOS/Kernel/Process/HleProcessDebugger.cs | 10 +- Ryujinx.HLE/HOS/Kernel/Process/KProcess.cs | 34 +-- .../Kernel/Process/KProcessCapabilities.cs | 6 +- .../HOS/Kernel/SupervisorCall/SvcSystem.cs | 6 +- .../HOS/Kernel/SupervisorCall/SvcTable.cs | 18 +- .../HOS/Kernel/SupervisorCall/SvcThread.cs | 2 +- .../HOS/Kernel/Threading/HleScheduler.cs | 18 +- .../HOS/Kernel/Threading/KAddressArbiter.cs | 22 +- .../HOS/Kernel/Threading/KCriticalSection.cs | 6 +- .../HOS/Kernel/Threading/KScheduler.cs | 34 +-- .../HOS/Kernel/Threading/KSynchronization.cs | 2 +- Ryujinx.HLE/HOS/Kernel/Threading/KThread.cs | 44 ++-- Ryujinx.HLE/HOS/ProgramLoader.cs | 2 +- .../HOS/Services/Am/IApplicationCreator.cs | 2 +- .../HOS/Services/Am/IApplicationFunctions.cs | 4 +- .../HOS/Services/Am/IDebugFunctions.cs | 2 +- .../HOS/Services/Am/IDisplayController.cs | 2 +- .../HOS/Services/Am/IGlobalStateController.cs | 2 +- .../HOS/Services/Am/IHomeMenuFunctions.cs | 2 +- .../HOS/Services/Am/IStorageAccessor.cs | 4 +- Ryujinx.HLE/HOS/Services/Am/StorageHelper.cs | 2 +- .../Aud/AudioRenderer/IAudioRenderer.cs | 10 +- .../AudioRenderer/VoiceChannelResourceIn.cs | 2 +- .../Aud/AudioRenderer/VoiceContext.cs | 14 +- Ryujinx.HLE/HOS/Services/Aud/IAudioDevice.cs | 2 +- .../HOS/Services/Aud/IHardwareOpusDecoder.cs | 4 +- .../Aud/IHardwareOpusDecoderManager.cs | 2 +- Ryujinx.HLE/HOS/Services/Bcat/IBcatService.cs | 2 +- .../Bcat/IDeliveryCacheStorageService.cs | 2 +- .../Services/Caps/IAlbumAccessorService.cs | 2 +- .../HOS/Services/Caps/IScreenshotService.cs | 2 +- .../Friend/IDaemonSuspendSessionService.cs | 2 +- .../HOS/Services/Friend/IFriendService.cs | 2 +- Ryujinx.HLE/HOS/Services/FspSrv/IFile.cs | 2 +- .../HOS/Services/FspSrv/IFileSystem.cs | 2 +- .../HOS/Services/FspSrv/IFileSystemProxy.cs | 2 +- Ryujinx.HLE/HOS/Services/FspSrv/IStorage.cs | 2 +- Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs | 4 +- Ryujinx.HLE/HOS/Services/Ldr/IRoInterface.cs | 2 +- .../HOS/Services/Ns/IAddOnContentManager.cs | 4 +- .../Ns/IApplicationManagerInterface.cs | 1 - .../HOS/Services/Ns/ISystemUpdateInterface.cs | 2 +- .../Ns/IVulnerabilityManagerInterface.cs | 2 +- Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs | 4 +- .../HOS/Services/Nv/NvGpuAS/NvGpuASCtx.cs | 8 +- .../HOS/Services/Nv/NvGpuAS/NvGpuASIoctl.cs | 8 +- .../Nv/NvHostChannel/NvHostChannelIoctl.cs | 4 +- .../Services/Nv/NvHostCtrl/NvHostCtrlIoctl.cs | 4 +- .../HOS/Services/Nv/NvMap/NvMapIoctl.cs | 10 +- .../Services/Pctl/IParentalControlService.cs | 1 - .../HOS/Services/Pl/ISharedFontManager.cs | 8 +- .../HOS/Services/Pm/IShellInterface.cs | 2 - .../HOS/Services/Set/ISystemSettingsServer.cs | 4 +- Ryujinx.HLE/HOS/Services/Set/NxSettings.cs | 2 +- Ryujinx.HLE/HOS/Services/Ssl/ISslContext.cs | 2 +- Ryujinx.HLE/HOS/Services/Vi/ColorFormat.cs | 3 +- Ryujinx.HLE/HOS/Services/Vi/GbpBuffer.cs | 2 +- .../Services/Vi/IApplicationDisplayService.cs | 8 +- .../HOS/Services/Vi/ISystemDisplayService.cs | 2 +- Ryujinx.HLE/HOS/Services/Vi/NvFlinger.cs | 9 +- Ryujinx.HLE/HOS/SystemState/SystemStateMgr.cs | 2 +- Ryujinx.HLE/Input/Hid.cs | 4 +- Ryujinx.HLE/Input/HidNpadController.cs | 2 +- Ryujinx.HLE/Loaders/Compression/Lz4.cs | 4 +- .../Loaders/Executables/NxStaticObject.cs | 6 +- Ryujinx.HLE/Loaders/Npdm/ACI0.cs | 2 +- Ryujinx.HLE/Loaders/Npdm/ACID.cs | 4 +- Ryujinx.HLE/Loaders/Npdm/Npdm.cs | 6 +- .../Loaders/Npdm/ServiceAccessControl.cs | 6 +- Ryujinx.HLE/Utilities/StringUtils.cs | 2 +- Ryujinx.Profiler/InternalProfile.cs | 10 +- Ryujinx.Profiler/Profile.cs | 6 +- Ryujinx.Profiler/ProfilerConfiguration.cs | 5 +- Ryujinx.Profiler/ProfilerKeyboardHandler.cs | 5 +- Ryujinx.Profiler/Settings.cs | 6 +- Ryujinx.Profiler/TimingFlag.cs | 7 +- Ryujinx.Profiler/TimingInfo.cs | 2 +- Ryujinx.Profiler/UI/ProfileSorters.cs | 1 - Ryujinx.Profiler/UI/ProfileWindow.cs | 6 +- Ryujinx.Profiler/UI/ProfileWindowBars.cs | 2 +- Ryujinx.Profiler/UI/ProfileWindowGraph.cs | 6 +- Ryujinx.Profiler/UI/ProfileWindowManager.cs | 3 +- .../UI/SharpFontHelpers/FontService.cs | 8 +- Ryujinx.Tests.Unicorn/IndexedProperty.cs | 4 +- Ryujinx.Tests.Unicorn/Native/ArmRegister.cs | 9 +- Ryujinx.Tests.Unicorn/Native/Interface.cs | 4 +- Ryujinx.Tests.Unicorn/Native/UnicornMode.cs | 1 + Ryujinx.Tests.Unicorn/UnicornAArch64.cs | 195 +++++++++--------- Ryujinx.Tests.Unicorn/UnicornError.cs | 3 +- Ryujinx/Config.jsonc | 14 +- Ryujinx/Configuration.cs | 18 +- Ryujinx/Program.cs | 6 +- Ryujinx/Ui/GLScreen.cs | 17 +- Ryujinx/Ui/NpadController.cs | 2 +- Ryujinx/Ui/NpadKeyboard.cs | 1 - Ryujinx/_schema.json | 8 +- 205 files changed, 1020 insertions(+), 1041 deletions(-) diff --git a/ChocolArm64/Decoders/Condition.cs b/ChocolArm64/Decoders/Condition.cs index 3f341a98..ef4b2959 100644 --- a/ChocolArm64/Decoders/Condition.cs +++ b/ChocolArm64/Decoders/Condition.cs @@ -24,8 +24,8 @@ namespace ChocolArm64.Decoders { public static Condition Invert(this Condition cond) { - //Bit 0 of all conditions is basically a negation bit, so - //inverting this bit has the effect of inverting the condition. + // Bit 0 of all conditions is basically a negation bit, so + // inverting this bit has the effect of inverting the condition. return (Condition)((int)cond ^ 1); } } diff --git a/ChocolArm64/Decoders/Decoder.cs b/ChocolArm64/Decoders/Decoder.cs index 6a95bc28..a1eeee15 100644 --- a/ChocolArm64/Decoders/Decoder.cs +++ b/ChocolArm64/Decoders/Decoder.cs @@ -29,12 +29,12 @@ namespace ChocolArm64.Decoders if (IsBranch(lastOp) && !IsCall(lastOp) && lastOp is IOpCodeBImm op) { - //It's possible that the branch on this block lands on the middle of the block. - //This is more common on tight loops. In this case, we can improve the codegen - //a bit by changing the CFG and either making the branch point to the same block - //(which indicates that the block is a loop that jumps back to the start), and the - //other possible case is a jump somewhere on the middle of the block, which is - //also a loop, but in this case we need to split the block in half. + // It's possible that the branch on this block lands on the middle of the block. + // This is more common on tight loops. In this case, we can improve the codegen + // a bit by changing the CFG and either making the branch point to the same block + // (which indicates that the block is a loop that jumps back to the start), and the + // other possible case is a jump somewhere on the middle of the block, which is + // also a loop, but in this case we need to split the block in half. if ((ulong)op.Imm == address) { block.Branch = block; @@ -79,7 +79,7 @@ namespace ChocolArm64.Decoders while (workQueue.TryDequeue(out Block currBlock)) { - //Check if the current block is inside another block. + // Check if the current block is inside another block. if (BinarySearch(blocks, currBlock.Address, out int nBlkIndex)) { Block nBlock = blocks[nBlkIndex]; @@ -96,7 +96,7 @@ namespace ChocolArm64.Decoders continue; } - //If we have a block after the current one, set the limit address. + // If we have a block after the current one, set the limit address. ulong limitAddress = ulong.MaxValue; if (nBlkIndex != blocks.Count) @@ -119,10 +119,10 @@ namespace ChocolArm64.Decoders if (currBlock.OpCodes.Count != 0) { - //Set child blocks. "Branch" is the block the branch instruction - //points to (when taken), "Next" is the block at the next address, - //executed when the branch is not taken. For Unconditional Branches - //(except BL/BLR that are sub calls) or end of executable, Next is null. + // Set child blocks. "Branch" is the block the branch instruction + // points to (when taken), "Next" is the block at the next address, + // executed when the branch is not taken. For Unconditional Branches + // (except BL/BLR that are sub calls) or end of executable, Next is null. OpCode64 lastOp = currBlock.GetLastOp(); bool isCall = IsCall(lastOp); @@ -138,7 +138,7 @@ namespace ChocolArm64.Decoders } } - //Insert the new block on the list (sorted by address). + // Insert the new block on the list (sorted by address). if (blocks.Count != 0) { Block nBlock = blocks[nBlkIndex]; @@ -236,25 +236,25 @@ namespace ChocolArm64.Decoders return false; } - //Note: On ARM32, most instructions have conditional execution, - //so there's no "Always" (unconditional) branch like on ARM64. - //We need to check if the condition is "Always" instead. + // Note: On ARM32, most instructions have conditional execution, + // so there's no "Always" (unconditional) branch like on ARM64. + // We need to check if the condition is "Always" instead. return IsAarch32Branch(op) && op.Cond >= Condition.Al; } private static bool IsAarch32Branch(OpCode64 opCode) { - //Note: On ARM32, most ALU operations can write to R15 (PC), - //so we must consider such operations as a branch in potential aswell. + // Note: On ARM32, most ALU operations can write to R15 (PC), + // so we must consider such operations as a branch in potential as well. if (opCode is IOpCode32Alu opAlu && opAlu.Rd == RegisterAlias.Aarch32Pc) { return true; } - //Same thing for memory operations. We have the cases where PC is a target - //register (Rt == 15 or (mask & (1 << 15)) != 0), and cases where there is - //a write back to PC (wback == true && Rn == 15), however the later may - //be "undefined" depending on the CPU, so compilers should not produce that. + // Same thing for memory operations. We have the cases where PC is a target + // register (Rt == 15 or (mask & (1 << 15)) != 0), and cases where there is + // a write back to PC (wback == true && Rn == 15), however the later may + // be "undefined" depending on the CPU, so compilers should not produce that. if (opCode is IOpCode32Mem || opCode is IOpCode32MemMult) { int rt, rn; @@ -268,8 +268,8 @@ namespace ChocolArm64.Decoders wBack = opMem.WBack; isLoad = opMem.IsLoad; - //For the dual load, we also need to take into account the - //case were Rt2 == 15 (PC). + // For the dual load, we also need to take into account the + // case were Rt2 == 15 (PC). if (rt == 14 && opMem.Emitter == InstEmit32.Ldrd) { rt = RegisterAlias.Aarch32Pc; @@ -296,14 +296,14 @@ namespace ChocolArm64.Decoders } } - //Explicit branch instructions. + // Explicit branch instructions. return opCode is IOpCode32BImm || opCode is IOpCode32BReg; } private static bool IsCall(OpCode64 opCode) { - //TODO (CQ): ARM32 support. + // TODO (CQ): ARM32 support. return opCode.Emitter == InstEmit.Bl || opCode.Emitter == InstEmit.Blr; } diff --git a/ChocolArm64/Decoders/OpCode32.cs b/ChocolArm64/Decoders/OpCode32.cs index 8534b78f..1909757c 100644 --- a/ChocolArm64/Decoders/OpCode32.cs +++ b/ChocolArm64/Decoders/OpCode32.cs @@ -16,8 +16,8 @@ namespace ChocolArm64.Decoders public uint GetPc() { - //Due to backwards compatibility and legacy behavior of ARMv4 CPUs pipeline, - //the PC actually points 2 instructions ahead. + // Due to backwards compatibility and legacy behavior of ARMv4 CPUs pipeline, + // the PC actually points 2 instructions ahead. return (uint)Position + (uint)OpCodeSizeInBytes * 2; } } diff --git a/ChocolArm64/Decoders/OpCode32BImm.cs b/ChocolArm64/Decoders/OpCode32BImm.cs index 43f191eb..7f3c29a6 100644 --- a/ChocolArm64/Decoders/OpCode32BImm.cs +++ b/ChocolArm64/Decoders/OpCode32BImm.cs @@ -10,7 +10,7 @@ namespace ChocolArm64.Decoders { uint pc = GetPc(); - //When the codition is never, the instruction is BLX to Thumb mode. + // When the condition is never, the instruction is BLX to Thumb mode. if (Cond != Condition.Nv) { pc &= ~3u; diff --git a/ChocolArm64/Decoders/OpCodeMemImm64.cs b/ChocolArm64/Decoders/OpCodeMemImm64.cs index d9f322ea..01a62ef5 100644 --- a/ChocolArm64/Decoders/OpCodeMemImm64.cs +++ b/ChocolArm64/Decoders/OpCodeMemImm64.cs @@ -23,16 +23,16 @@ namespace ChocolArm64.Decoders Extend64 = ((opCode >> 22) & 3) == 2; WBack = ((opCode >> 24) & 1) == 0; - //The type is not valid for the Unsigned Immediate 12-bits encoding, - //because the bits 11:10 are used for the larger Immediate offset. + // The type is not valid for the Unsigned Immediate 12-bits encoding, + // because the bits 11:10 are used for the larger Immediate offset. MemOp type = WBack ? (MemOp)((opCode >> 10) & 3) : MemOp.Unsigned; PostIdx = type == MemOp.PostIndexed; Unscaled = type == MemOp.Unscaled || type == MemOp.Unprivileged; - //Unscaled and Unprivileged doesn't write back, - //but they do use the 9-bits Signed Immediate. + // Unscaled and Unprivileged doesn't write back, + // but they do use the 9-bits Signed Immediate. if (Unscaled) { WBack = false; @@ -40,12 +40,12 @@ namespace ChocolArm64.Decoders if (WBack || Unscaled) { - //9-bits Signed Immediate. + // 9-bits Signed Immediate. Imm = (opCode << 11) >> 23; } else { - //12-bits Unsigned Immediate. + // 12-bits Unsigned Immediate. Imm = ((opCode >> 10) & 0xfff) << Size; } } diff --git a/ChocolArm64/Decoders/OpCodeSimdImm64.cs b/ChocolArm64/Decoders/OpCodeSimdImm64.cs index 37ee504d..27f586f1 100644 --- a/ChocolArm64/Decoders/OpCodeSimdImm64.cs +++ b/ChocolArm64/Decoders/OpCodeSimdImm64.cs @@ -30,14 +30,14 @@ namespace ChocolArm64.Decoders switch (op | (modeLow << 1)) { case 0: - //64-bits Immediate. - //Transform abcd efgh into abcd efgh abcd efgh ... + // 64-bits Immediate. + // Transform abcd efgh into abcd efgh abcd efgh ... imm = (long)((ulong)imm * 0x0101010101010101); break; case 1: - //64-bits Immediate. - //Transform abcd efgh into aaaa aaaa bbbb bbbb ... + // 64-bits Immediate. + // Transform abcd efgh into aaaa aaaa bbbb bbbb ... imm = (imm & 0xf0) >> 4 | (imm & 0x0f) << 4; imm = (imm & 0xcc) >> 2 | (imm & 0x33) << 2; imm = (imm & 0xaa) >> 1 | (imm & 0x55) << 1; @@ -52,29 +52,29 @@ namespace ChocolArm64.Decoders case 2: case 3: - //Floating point Immediate. + // Floating point Immediate. imm = DecoderHelper.DecodeImm8Float(imm, Size); break; } } else if ((modeHigh & 0b110) == 0b100) { - //16-bits shifted Immediate. + // 16-bits shifted Immediate. Size = 1; imm <<= (modeHigh & 1) << 3; } else if ((modeHigh & 0b100) == 0b000) { - //32-bits shifted Immediate. + // 32-bits shifted Immediate. Size = 2; imm <<= modeHigh << 3; } else if ((modeHigh & 0b111) == 0b110) { - //32-bits shifted Immediate (fill with ones). + // 32-bits shifted Immediate (fill with ones). Size = 2; imm = ShlOnes(imm, 8 << modeLow); } else { - //8 bits without shift. + // 8 bits without shift. Size = 0; } diff --git a/ChocolArm64/Instructions/InstEmit32Helper.cs b/ChocolArm64/Instructions/InstEmit32Helper.cs index 49377981..c5d08b8a 100644 --- a/ChocolArm64/Instructions/InstEmit32Helper.cs +++ b/ChocolArm64/Instructions/InstEmit32Helper.cs @@ -24,7 +24,7 @@ namespace ChocolArm64.Instructions } else { - context.EmitLdint(InstEmit32Helper.GetRegisterAlias(context.Mode, register)); + context.EmitLdint(GetRegisterAlias(context.Mode, register)); } } diff --git a/ChocolArm64/Instructions/InstEmitAlu.cs b/ChocolArm64/Instructions/InstEmitAlu.cs index 36ce8c7f..25bd8e64 100644 --- a/ChocolArm64/Instructions/InstEmitAlu.cs +++ b/ChocolArm64/Instructions/InstEmitAlu.cs @@ -151,7 +151,7 @@ namespace ChocolArm64.Instructions public static void Extr(ILEmitterCtx context) { - //TODO: Ensure that the Shift is valid for the Is64Bits. + // TODO: Ensure that the Shift is valid for the Is64Bits. OpCodeAluRs64 op = (OpCodeAluRs64)context.CurrOp; context.EmitLdintzr(op.Rm); @@ -309,7 +309,7 @@ namespace ChocolArm64.Instructions private static void EmitDiv(ILEmitterCtx context, OpCode ilOp) { - //If Rm == 0, Rd = 0 (division by zero). + // If Rm == 0, Rd = 0 (division by zero). context.EmitLdc_I(0); EmitAluLoadRm(context); @@ -323,7 +323,7 @@ namespace ChocolArm64.Instructions if (ilOp == OpCodes.Div) { - //If Rn == INT_MIN && Rm == -1, Rd = INT_MIN (overflow). + // If Rn == INT_MIN && Rm == -1, Rd = INT_MIN (overflow). long intMin = 1L << (context.CurrOp.GetBitsCount() - 1); context.EmitLdc_I(intMin); @@ -381,10 +381,10 @@ namespace ChocolArm64.Instructions context.Emit(OpCodes.And); - //Note: Only 32-bits shift values are valid, so when the value is 64-bits - //we need to cast it to a 32-bits integer. This is fine because we - //AND the value and only keep the lower 5 or 6 bits anyway -- it - //could very well fit on a byte. + // Note: Only 32-bits shift values are valid, so when the value is 64-bits + // we need to cast it to a 32-bits integer. This is fine because we + // AND the value and only keep the lower 5 or 6 bits anyway -- it + // could very well fit on a byte. if (context.CurrOp.RegisterSize != RegisterSize.Int32) { context.Emit(OpCodes.Conv_I4); diff --git a/ChocolArm64/Instructions/InstEmitAlu32.cs b/ChocolArm64/Instructions/InstEmitAlu32.cs index 0b4bac2f..94a8c750 100644 --- a/ChocolArm64/Instructions/InstEmitAlu32.cs +++ b/ChocolArm64/Instructions/InstEmitAlu32.cs @@ -87,7 +87,7 @@ namespace ChocolArm64.Instructions { if (op.SetFlags) { - //TODO: Load SPSR etc. + // TODO: Load SPSR etc. context.EmitLdflg((int)PState.TBit); diff --git a/ChocolArm64/Instructions/InstEmitAluHelper.cs b/ChocolArm64/Instructions/InstEmitAluHelper.cs index 181f645a..64822088 100644 --- a/ChocolArm64/Instructions/InstEmitAluHelper.cs +++ b/ChocolArm64/Instructions/InstEmitAluHelper.cs @@ -10,7 +10,7 @@ namespace ChocolArm64.Instructions { public static void EmitAdcsCCheck(ILEmitterCtx context) { - //C = (Rd == Rn && CIn) || Rd < Rn + // C = (Rd == Rn && CIn) || Rd < Rn context.EmitSttmp(); context.EmitLdtmp(); context.EmitLdtmp(); @@ -35,7 +35,7 @@ namespace ChocolArm64.Instructions public static void EmitAddsCCheck(ILEmitterCtx context) { - //C = Rd < Rn + // C = Rd < Rn context.Emit(OpCodes.Dup); EmitAluLoadRn(context); @@ -47,7 +47,7 @@ namespace ChocolArm64.Instructions public static void EmitAddsVCheck(ILEmitterCtx context) { - //V = (Rd ^ Rn) & ~(Rn ^ Rm) < 0 + // V = (Rd ^ Rn) & ~(Rn ^ Rm) < 0 context.Emit(OpCodes.Dup); EmitAluLoadRn(context); @@ -69,7 +69,7 @@ namespace ChocolArm64.Instructions public static void EmitSbcsCCheck(ILEmitterCtx context) { - //C = (Rn == Rm && CIn) || Rn > Rm + // C = (Rn == Rm && CIn) || Rn > Rm EmitAluLoadOpers(context); context.Emit(OpCodes.Ceq); @@ -88,7 +88,7 @@ namespace ChocolArm64.Instructions public static void EmitSubsCCheck(ILEmitterCtx context) { - //C = Rn == Rm || Rn > Rm = !(Rn < Rm) + // C = Rn == Rm || Rn > Rm = !(Rn < Rm) EmitAluLoadOpers(context); context.Emit(OpCodes.Clt_Un); @@ -102,7 +102,7 @@ namespace ChocolArm64.Instructions public static void EmitSubsVCheck(ILEmitterCtx context) { - //V = (Rd ^ Rn) & (Rn ^ Rm) < 0 + // V = (Rd ^ Rn) & (Rn ^ Rm) < 0 context.Emit(OpCodes.Dup); EmitAluLoadRn(context); @@ -170,7 +170,7 @@ namespace ChocolArm64.Instructions { switch (context.CurrOp) { - //ARM32. + // ARM32. case OpCode32AluImm op: context.EmitLdc_I4(op.Imm); @@ -190,7 +190,7 @@ namespace ChocolArm64.Instructions context.EmitLdc_I4(op.Imm); break; - //ARM64. + // ARM64. case IOpCodeAluImm64 op: context.EmitLdc_I(op.Imm); break; @@ -245,7 +245,7 @@ namespace ChocolArm64.Instructions context.EmitStflg((int)PState.NBit); } - //ARM32 helpers. + // ARM32 helpers. private static void EmitLoadRmShiftedByImmediate(ILEmitterCtx context, OpCode32AluRsImm op, bool setCarry) { int shift = op.Imm; @@ -432,7 +432,7 @@ namespace ChocolArm64.Instructions private static void EmitRrxC(ILEmitterCtx context, bool setCarry) { - //Rotate right by 1 with carry. + // Rotate right by 1 with carry. if (setCarry) { context.Emit(OpCodes.Dup); diff --git a/ChocolArm64/Instructions/InstEmitBfm.cs b/ChocolArm64/Instructions/InstEmitBfm.cs index 4a039599..75e259c1 100644 --- a/ChocolArm64/Instructions/InstEmitBfm.cs +++ b/ChocolArm64/Instructions/InstEmitBfm.cs @@ -13,7 +13,7 @@ namespace ChocolArm64.Instructions if (op.Pos < op.Shift) { - //BFI. + // BFI. context.EmitLdintzr(op.Rn); int shift = op.GetBitsCount() - op.Shift; @@ -39,7 +39,7 @@ namespace ChocolArm64.Instructions } else { - //BFXIL. + // BFXIL. context.EmitLdintzr(op.Rn); context.EmitLsr(op.Shift); diff --git a/ChocolArm64/Instructions/InstEmitException.cs b/ChocolArm64/Instructions/InstEmitException.cs index 7922c62b..c835fb0d 100644 --- a/ChocolArm64/Instructions/InstEmitException.cs +++ b/ChocolArm64/Instructions/InstEmitException.cs @@ -31,8 +31,8 @@ namespace ChocolArm64.Instructions context.EmitPrivateCall(typeof(CpuThreadState), mthdName); - //Check if the thread should still be running, if it isn't then we return 0 - //to force a return to the dispatcher and then exit the thread. + // Check if the thread should still be running, if it isn't then we return 0 + // to force a return to the dispatcher and then exit the thread. context.EmitLdarg(TranslatedSub.StateArgIdx); context.EmitCallPropGet(typeof(CpuThreadState), nameof(CpuThreadState.Running)); diff --git a/ChocolArm64/Instructions/InstEmitFlow32.cs b/ChocolArm64/Instructions/InstEmitFlow32.cs index b0b9754f..133e2784 100644 --- a/ChocolArm64/Instructions/InstEmitFlow32.cs +++ b/ChocolArm64/Instructions/InstEmitFlow32.cs @@ -66,8 +66,8 @@ namespace ChocolArm64.Instructions context.EmitStint(GetBankedRegisterAlias(context.Mode, RegisterAlias.Aarch32Lr)); - //If x is true, then this is a branch with link and exchange. - //In this case we need to swap the mode between Arm <-> Thumb. + // If x is true, then this is a branch with link and exchange. + // In this case we need to swap the mode between Arm <-> Thumb. if (x) { context.EmitLdc_I4(isThumb ? 0 : 1); diff --git a/ChocolArm64/Instructions/InstEmitFlowHelper.cs b/ChocolArm64/Instructions/InstEmitFlowHelper.cs index e7a6bf38..f36fe5a1 100644 --- a/ChocolArm64/Instructions/InstEmitFlowHelper.cs +++ b/ChocolArm64/Instructions/InstEmitFlowHelper.cs @@ -90,10 +90,10 @@ namespace ChocolArm64.Instructions if (isJump) { - //The tail prefix allows the JIT to jump to the next function, - //while releasing the stack space used by the current one. - //This is ideal for BR ARM instructions, which are - //basically indirect tail calls. + // The tail prefix allows the JIT to jump to the next function, + // while releasing the stack space used by the current one. + // This is ideal for BR ARM instructions, which are + // basically indirect tail calls. context.Emit(OpCodes.Tailcall); } @@ -114,10 +114,10 @@ namespace ChocolArm64.Instructions private static void EmitContinueOrReturnCheck(ILEmitterCtx context) { - //Note: The return value of the called method will be placed - //at the Stack, the return value is always a Int64 with the - //return address of the function. We check if the address is - //correct, if it isn't we keep returning until we reach the dispatcher. + // Note: The return value of the called method will be placed + // at the Stack, the return value is always a Int64 with the + // return address of the function. We check if the address is + // correct, if it isn't we keep returning until we reach the dispatcher. if (context.CurrBlock.Next != null) { context.Emit(OpCodes.Dup); diff --git a/ChocolArm64/Instructions/InstEmitMemory.cs b/ChocolArm64/Instructions/InstEmitMemory.cs index ea779c8d..1328f393 100644 --- a/ChocolArm64/Instructions/InstEmitMemory.cs +++ b/ChocolArm64/Instructions/InstEmitMemory.cs @@ -192,7 +192,7 @@ namespace ChocolArm64.Instructions if (!op.PostIdx) { - //Pre-indexing. + // Pre-indexing. context.EmitLdc_I(op.Imm); context.Emit(OpCodes.Add); @@ -213,7 +213,7 @@ namespace ChocolArm64.Instructions break; } - //Save address to Scratch var since the register value may change. + // Save address to Scratch var since the register value may change. context.Emit(OpCodes.Dup); context.EmitSttmp(); @@ -221,8 +221,8 @@ namespace ChocolArm64.Instructions private static void EmitWBackIfNeeded(ILEmitterCtx context) { - //Check whenever the current OpCode has post-indexed write back, if so write it. - //Note: AOpCodeMemPair inherits from AOpCodeMemImm, so this works for both. + // Check whenever the current OpCode has post-indexed write back, if so write it. + // Note: AOpCodeMemPair inherits from AOpCodeMemImm, so this works for both. if (context.CurrOp is OpCodeMemImm64 op && op.WBack) { context.EmitLdtmp(); diff --git a/ChocolArm64/Instructions/InstEmitMemory32.cs b/ChocolArm64/Instructions/InstEmitMemory32.cs index 647d5755..807a65fe 100644 --- a/ChocolArm64/Instructions/InstEmitMemory32.cs +++ b/ChocolArm64/Instructions/InstEmitMemory32.cs @@ -137,15 +137,15 @@ namespace ChocolArm64.Instructions EmitWriteCall(context, WordSizeLog2); - //Note: If Rn is also specified on the register list, - //and Rn is the first register on this list, then the - //value that is written to memory is the unmodified value, - //before the write back. If it is on the list, but it's - //not the first one, then the value written to memory - //varies between CPUs. + // Note: If Rn is also specified on the register list, + // and Rn is the first register on this list, then the + // value that is written to memory is the unmodified value, + // before the write back. If it is on the list, but it's + // not the first one, then the value written to memory + // varies between CPUs. if (offset == 0 && op.PostOffset != 0) { - //Emit write back after the first write. + // Emit write back after the first write. EmitLoadFromRegister(context, op.Rn); context.EmitLdc_I4(op.PostOffset); @@ -233,7 +233,7 @@ namespace ChocolArm64.Instructions context.Emit(OpCodes.Brtrue_S, lblBigEndian); - //Little endian mode. + // Little endian mode. context.Emit(OpCodes.Conv_U4); EmitStoreToRegister(context, op.Rt); @@ -246,7 +246,7 @@ namespace ChocolArm64.Instructions context.Emit(OpCodes.Br_S, lblEnd); - //Big endian mode. + // Big endian mode. context.MarkLabel(lblBigEndian); context.EmitLsr(32); @@ -288,7 +288,7 @@ namespace ChocolArm64.Instructions context.Emit(OpCodes.Brtrue_S, lblBigEndian); - //Little endian mode. + // Little endian mode. EmitLoadFromRegister(context, op.Rt | 1); context.Emit(OpCodes.Conv_U8); @@ -299,7 +299,7 @@ namespace ChocolArm64.Instructions context.Emit(OpCodes.Br_S, lblEnd); - //Big endian mode. + // Big endian mode. context.MarkLabel(lblBigEndian); context.EmitLsl(32); diff --git a/ChocolArm64/Instructions/InstEmitMemoryEx.cs b/ChocolArm64/Instructions/InstEmitMemoryEx.cs index 329fba7e..5deb035d 100644 --- a/ChocolArm64/Instructions/InstEmitMemoryEx.cs +++ b/ChocolArm64/Instructions/InstEmitMemoryEx.cs @@ -89,10 +89,10 @@ namespace ChocolArm64.Instructions if (pair) { - //Exclusive loads should be atomic. For pairwise loads, we need to - //read all the data at once. For a 32-bits pairwise load, we do a - //simple 64-bits load, for a 128-bits load, we need to call a special - //method to read 128-bits atomically. + // Exclusive loads should be atomic. For pairwise loads, we need to + // read all the data at once. For a 32-bits pairwise load, we do a + // simple 64-bits load, for a 128-bits load, we need to call a special + // method to read 128-bits atomically. if (op.Size == 2) { context.EmitLdtmp(); @@ -101,7 +101,7 @@ namespace ChocolArm64.Instructions context.Emit(OpCodes.Dup); - //Mask low half. + // Mask low half. context.Emit(OpCodes.Conv_U4); if (exclusive) @@ -111,7 +111,7 @@ namespace ChocolArm64.Instructions context.EmitStintzr(op.Rt); - //Shift high half. + // Shift high half. context.EmitLsr(32); context.Emit(OpCodes.Conv_U4); @@ -131,7 +131,7 @@ namespace ChocolArm64.Instructions context.Emit(OpCodes.Dup); - //Load low part of the vector. + // Load low part of the vector. context.EmitLdc_I4(0); context.EmitLdc_I4(3); @@ -144,7 +144,7 @@ namespace ChocolArm64.Instructions context.EmitStintzr(op.Rt); - //Load high part of the vector. + // Load high part of the vector. context.EmitLdc_I4(1); context.EmitLdc_I4(3); @@ -164,7 +164,7 @@ namespace ChocolArm64.Instructions } else { - //8, 16, 32 or 64-bits (non-pairwise) load. + // 8, 16, 32 or 64-bits (non-pairwise) load. context.EmitLdtmp(); EmitReadZxCall(context, op.Size); @@ -180,7 +180,7 @@ namespace ChocolArm64.Instructions public static void Pfrm(ILEmitterCtx context) { - //Memory Prefetch, execute as no-op. + // Memory Prefetch, execute as no-op. } public static void Stlr(ILEmitterCtx context) => EmitStr(context, AccessType.Ordered); @@ -223,13 +223,13 @@ namespace ChocolArm64.Instructions context.Emit(OpCodes.Brtrue_S, lblEx); - //Address check failed, set error right away and do not store anything. + // Address check failed, set error right away and do not store anything. context.EmitLdc_I4(1); context.EmitStintzr(op.Rs); context.Emit(OpCodes.Br, lblEnd); - //Address check passsed. + // Address check passed. context.MarkLabel(lblEx); context.EmitLdarg(TranslatedSub.MemoryArgIdx); @@ -241,7 +241,7 @@ namespace ChocolArm64.Instructions void EmitCast() { - //The input should be always int64. + // The input should be always int64. switch (op.Size) { case 0: context.Emit(OpCodes.Conv_U1); break; @@ -293,10 +293,10 @@ namespace ChocolArm64.Instructions } } - //The value returned is a bool, true if the values compared - //were equal and the new value was written, false otherwise. - //We need to invert this result, as on ARM 1 indicates failure, - //and 0 success on those instructions. + // The value returned is a bool, true if the values compared + // were equal and the new value was written, false otherwise. + // We need to invert this result, as on ARM 1 indicates failure, + // and 0 success on those instructions. context.EmitLdc_I4(1); context.Emit(OpCodes.Xor); @@ -305,7 +305,7 @@ namespace ChocolArm64.Instructions context.EmitStintzr(op.Rs); - //Only clear the exclusive monitor if the store was successful (Rs = false). + // Only clear the exclusive monitor if the store was successful (Rs = false). context.Emit(OpCodes.Brtrue_S, lblEnd); Clrex(context); @@ -341,9 +341,9 @@ namespace ChocolArm64.Instructions private static void EmitBarrier(ILEmitterCtx context) { - //Note: This barrier is most likely not necessary, and probably - //doesn't make any difference since we need to do a ton of stuff - //(software MMU emulation) to read or write anything anyway. + // Note: This barrier is most likely not necessary, and probably + // doesn't make any difference since we need to do a ton of stuff + // (software MMU emulation) to read or write anything anyway. context.EmitCall(typeof(Thread), nameof(Thread.MemoryBarrier)); } } diff --git a/ChocolArm64/Instructions/InstEmitMemoryHelper.cs b/ChocolArm64/Instructions/InstEmitMemoryHelper.cs index 4dc40b1a..dbb58886 100644 --- a/ChocolArm64/Instructions/InstEmitMemoryHelper.cs +++ b/ChocolArm64/Instructions/InstEmitMemoryHelper.cs @@ -40,7 +40,7 @@ namespace ChocolArm64.Instructions private static void EmitReadCall(ILEmitterCtx context, Extension ext, int size) { - //Save the address into a temp. + // Save the address into a temp. context.EmitStint(_tempIntAddress); bool isSimd = IsSimd(context); @@ -99,7 +99,7 @@ namespace ChocolArm64.Instructions { bool isSimd = IsSimd(context); - //Save the value into a temp. + // Save the value into a temp. if (isSimd) { context.EmitStvec(_tempVecValue); @@ -109,7 +109,7 @@ namespace ChocolArm64.Instructions context.EmitStint(_tempIntValue); } - //Save the address into a temp. + // Save the address into a temp. context.EmitStint(_tempIntAddress); if (size < 0 || size > (isSimd ? 4 : 3)) diff --git a/ChocolArm64/Instructions/InstEmitSimdHelper.cs b/ChocolArm64/Instructions/InstEmitSimdHelper.cs index f343dba8..573b8040 100644 --- a/ChocolArm64/Instructions/InstEmitSimdHelper.cs +++ b/ChocolArm64/Instructions/InstEmitSimdHelper.cs @@ -1298,8 +1298,8 @@ namespace ChocolArm64.Instructions { if (Optimizations.UseSse41 && size == 0) { - //If the type is float, we can perform insertion and - //zero the upper bits with a single instruction (INSERTPS); + // If the type is float, we can perform insertion and + // zero the upper bits with a single instruction (INSERTPS); context.EmitLdvec(reg); VectorHelper.EmitCall(context, nameof(VectorHelper.Sse41VectorInsertScalarSingle)); diff --git a/ChocolArm64/Instructions/InstEmitSimdMemory.cs b/ChocolArm64/Instructions/InstEmitSimdMemory.cs index 18ec1d33..073b0f0a 100644 --- a/ChocolArm64/Instructions/InstEmitSimdMemory.cs +++ b/ChocolArm64/Instructions/InstEmitSimdMemory.cs @@ -96,7 +96,7 @@ namespace ChocolArm64.Instructions if (op.Replicate) { - //Only loads uses the replicate mode. + // Only loads uses the replicate mode. if (!isLoad) { throw new InvalidOperationException(); diff --git a/ChocolArm64/Instructions/InstEmitSystem.cs b/ChocolArm64/Instructions/InstEmitSystem.cs index 5687768a..d0d60b9d 100644 --- a/ChocolArm64/Instructions/InstEmitSystem.cs +++ b/ChocolArm64/Instructions/InstEmitSystem.cs @@ -11,12 +11,12 @@ namespace ChocolArm64.Instructions { public static void Hint(ILEmitterCtx context) { - //Execute as no-op. + // Execute as no-op. } public static void Isb(ILEmitterCtx context) { - //Execute as no-op. + // Execute as no-op. } public static void Mrs(ILEmitterCtx context) @@ -85,21 +85,21 @@ namespace ChocolArm64.Instructions public static void Nop(ILEmitterCtx context) { - //Do nothing. + // Do nothing. } public static void Sys(ILEmitterCtx context) { - //This instruction is used to do some operations on the CPU like cache invalidation, - //address translation and the like. - //We treat it as no-op here since we don't have any cache being emulated anyway. + // This instruction is used to do some operations on the CPU like cache invalidation, + // address translation and the like. + // We treat it as no-op here since we don't have any cache being emulated anyway. OpCodeSystem64 op = (OpCodeSystem64)context.CurrOp; switch (GetPackedId(op)) { case 0b11_011_0111_0100_001: { - //DC ZVA + // DC ZVA for (int offs = 0; offs < (4 << CpuThreadState.DczSizeLog2); offs += 8) { context.EmitLdintzr(op.Rt); @@ -115,7 +115,7 @@ namespace ChocolArm64.Instructions break; } - //No-op + // No-op case 0b11_011_0111_1110_001: //DC CIVAC break; } diff --git a/ChocolArm64/Instructions/VectorHelper.cs b/ChocolArm64/Instructions/VectorHelper.cs index 3e2b258a..4d57e285 100644 --- a/ChocolArm64/Instructions/VectorHelper.cs +++ b/ChocolArm64/Instructions/VectorHelper.cs @@ -583,9 +583,9 @@ namespace ChocolArm64.Instructions { if (Sse41.IsSupported) { - //Note: The if/else if is necessary to enable the JIT to - //produce a single INSERTPS instruction instead of the - //jump table fallback. + // Note: The if/else if is necessary to enable the JIT to + // produce a single INSERTPS instruction instead of the + // jump table fallback. if (index == 0) { return Sse41.Insert(vector, value, 0x00); @@ -628,7 +628,7 @@ namespace ChocolArm64.Instructions [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Vector128 Sse41VectorInsertScalarSingle(float value, Vector128 vector) { - //Note: 0b1110 is the mask to zero the upper bits. + // Note: 0b1110 is the mask to zero the upper bits. return Sse41.Insert(vector, value, 0b1110); } diff --git a/ChocolArm64/Memory/MemoryManagement.cs b/ChocolArm64/Memory/MemoryManagement.cs index fa4bc4fa..80585791 100644 --- a/ChocolArm64/Memory/MemoryManagement.cs +++ b/ChocolArm64/Memory/MemoryManagement.cs @@ -96,9 +96,9 @@ namespace ChocolArm64.Memory IntPtr[] addresses, out ulong count) { - //This is only supported on windows, but returning - //false (failed) is also valid for platforms without - //write tracking support on the OS. + // This is only supported on windows, but returning + // false (failed) is also valid for platforms without + // write tracking support on the OS. if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { return MemoryManagementWindows.GetModifiedPages(address, size, addresses, out count); diff --git a/ChocolArm64/Memory/MemoryManagementUnix.cs b/ChocolArm64/Memory/MemoryManagementUnix.cs index 9fe1aef0..fe3cfb7e 100644 --- a/ChocolArm64/Memory/MemoryManagementUnix.cs +++ b/ChocolArm64/Memory/MemoryManagementUnix.cs @@ -30,22 +30,22 @@ namespace ChocolArm64.Memory return ptr; } - public static bool Reprotect(IntPtr address, ulong size, Memory.MemoryProtection protection) + public static bool Reprotect(IntPtr address, ulong size, MemoryProtection protection) { MmapProts prot = GetProtection(protection); return Syscall.mprotect(address, size, prot) == 0; } - private static MmapProts GetProtection(Memory.MemoryProtection protection) + private static MmapProts GetProtection(MemoryProtection protection) { switch (protection) { - case Memory.MemoryProtection.None: return MmapProts.PROT_NONE; - case Memory.MemoryProtection.Read: return MmapProts.PROT_READ; - case Memory.MemoryProtection.ReadAndWrite: return MmapProts.PROT_READ | MmapProts.PROT_WRITE; - case Memory.MemoryProtection.ReadAndExecute: return MmapProts.PROT_READ | MmapProts.PROT_EXEC; - case Memory.MemoryProtection.Execute: return MmapProts.PROT_EXEC; + case MemoryProtection.None: return MmapProts.PROT_NONE; + case MemoryProtection.Read: return MmapProts.PROT_READ; + case MemoryProtection.ReadAndWrite: return MmapProts.PROT_READ | MmapProts.PROT_WRITE; + case MemoryProtection.ReadAndExecute: return MmapProts.PROT_READ | MmapProts.PROT_EXEC; + case MemoryProtection.Execute: return MmapProts.PROT_EXEC; default: throw new ArgumentException($"Invalid permission \"{protection}\"."); } diff --git a/ChocolArm64/Memory/MemoryManager.cs b/ChocolArm64/Memory/MemoryManager.cs index ce102e09..364f6b58 100644 --- a/ChocolArm64/Memory/MemoryManager.cs +++ b/ChocolArm64/Memory/MemoryManager.cs @@ -50,12 +50,12 @@ namespace ChocolArm64.Memory AddressSpaceBits = addressSpaceBits; AddressSpaceSize = 1L << addressSpaceBits; - //When flat page table is requested, we use a single - //array for the mappings of the entire address space. - //This has better performance, but also high memory usage. - //The multi level page table uses 9 bits per level, so - //the memory usage is lower, but the performance is also - //lower, since each address translation requires multiple reads. + // When flat page table is requested, we use a single + // array for the mappings of the entire address space. + // This has better performance, but also high memory usage. + // The multi level page table uses 9 bits per level, so + // the memory usage is lower, but the performance is also + // lower, since each address translation requires multiple reads. if (useFlatPageTable) { PtLevelBits = addressSpaceBits - PageBits; @@ -237,13 +237,13 @@ namespace ChocolArm64.Memory if (nextPtr == IntPtr.Zero) { - //Entry does not yet exist, allocate a new one. + // Entry does not yet exist, allocate a new one. IntPtr newPtr = Allocate((ulong)(PtLevelSize * IntPtr.Size)); - //Try to swap the current pointer (should be zero), with the allocated one. + // Try to swap the current pointer (should be zero), with the allocated one. nextPtr = Interlocked.Exchange(ref *ptePtr, newPtr); - //If the old pointer is not null, then another thread already has set it. + // If the old pointer is not null, then another thread already has set it. if (nextPtr != IntPtr.Zero) { Free(newPtr); @@ -533,7 +533,7 @@ namespace ChocolArm64.Memory private void AbortWithAlignmentFault(long position) { - //TODO: Abort mode and exception support on the CPU. + // TODO: Abort mode and exception support on the CPU. throw new InvalidOperationException($"Tried to compare exchange a misaligned address 0x{position:X16}."); } @@ -726,7 +726,7 @@ namespace ChocolArm64.Memory public void ReadBytes(long position, byte[] data, int startIndex, int size) { - //Note: This will be moved later. + // Note: This will be moved later. long endAddr = position + size; if ((ulong)size > int.MaxValue) @@ -924,7 +924,7 @@ namespace ChocolArm64.Memory public void WriteBytes(long position, byte[] data, int startIndex, int size) { - //Note: This will be moved later. + // Note: This will be moved later. long endAddr = position + size; if ((ulong)endAddr < (ulong)position) @@ -954,7 +954,7 @@ namespace ChocolArm64.Memory public void CopyBytes(long src, long dst, long size) { - //Note: This will be moved later. + // Note: This will be moved later. if (IsContiguous(src, size) && IsContiguous(dst, size)) { diff --git a/ChocolArm64/OpCodeTable.cs b/ChocolArm64/OpCodeTable.cs index 74cbdab0..819881ed 100644 --- a/ChocolArm64/OpCodeTable.cs +++ b/ChocolArm64/OpCodeTable.cs @@ -36,7 +36,7 @@ namespace ChocolArm64 static OpCodeTable() { #region "OpCode Table (AArch32)" - //Integer + // Integer SetA32("<<<<0010100xxxxxxxxxxxxxxxxxxxxx", InstEmit32.Add, typeof(OpCode32AluImm)); SetA32("<<<<0000100xxxxxxxxxxxxxxxx0xxxx", InstEmit32.Add, typeof(OpCode32AluRsImm)); SetA32("<<<<1010xxxxxxxxxxxxxxxxxxxxxxxx", InstEmit32.B, typeof(OpCode32BImm)); @@ -66,7 +66,7 @@ namespace ChocolArm64 #endregion #region "OpCode Table (AArch64)" - //Integer + // Integer SetA64("x0011010000xxxxx000000xxxxxxxxxx", InstEmit.Adc, typeof(OpCodeAluRs64)); SetA64("x0111010000xxxxx000000xxxxxxxxxx", InstEmit.Adcs, typeof(OpCodeAluRs64)); SetA64("x00100010xxxxxxxxxxxxxxxxxxxxxxx", InstEmit.Add, typeof(OpCodeAluImm64)); @@ -217,7 +217,7 @@ namespace ChocolArm64 SetA64("10011011101xxxxx1xxxxxxxxxxxxxxx", InstEmit.Umsubl, typeof(OpCodeMul64)); SetA64("10011011110xxxxx0xxxxxxxxxxxxxxx", InstEmit.Umulh, typeof(OpCodeMul64)); - //Vector + // Vector SetA64("0101111011100000101110xxxxxxxxxx", InstEmit.Abs_S, typeof(OpCodeSimd64)); SetA64("0>001110<<100000101110xxxxxxxxxx", InstEmit.Abs_V, typeof(OpCodeSimd64)); SetA64("01011110111xxxxx100001xxxxxxxxxx", InstEmit.Add_S, typeof(OpCodeSimdReg64)); @@ -656,12 +656,12 @@ namespace ChocolArm64 for (int index = 0; index < encoding.Length; index++, bit--) { - //Note: < and > are used on special encodings. - //The < means that we should never have ALL bits with the '<' set. - //So, when the encoding has <<, it means that 00, 01, and 10 are valid, - //but not 11. <<< is 000, 001, ..., 110 but NOT 111, and so on... - //For >, the invalid value is zero. So, for >> 01, 10 and 11 are valid, - //but 00 isn't. + // Note: < and > are used on special encodings. + // The < means that we should never have ALL bits with the '<' set. + // So, when the encoding has <<, it means that 00, 01, and 10 are valid, + // but not 11. <<< is 000, 001, ..., 110 but NOT 111, and so on... + // For >, the invalid value is zero. So, for >> 01, 10 and 11 are valid, + // but 00 isn't. char chr = encoding[index]; if (chr == '1') diff --git a/ChocolArm64/State/CpuThreadState.cs b/ChocolArm64/State/CpuThreadState.cs index 1cbbcf40..424f1725 100644 --- a/ChocolArm64/State/CpuThreadState.cs +++ b/ChocolArm64/State/CpuThreadState.cs @@ -126,8 +126,8 @@ namespace ChocolArm64.State [MethodImpl(MethodImplOptions.AggressiveInlining)] internal bool Synchronize() { - //Firing a interrupt frequently is expensive, so we only - //do it after a given number of instructions has executed. + // Firing a interrupt frequently is expensive, so we only + // do it after a given number of instructions has executed. _syncCount++; if (_syncCount >= MinCountForCheck) diff --git a/ChocolArm64/Translation/ILEmitterCtx.cs b/ChocolArm64/Translation/ILEmitterCtx.cs index b4360fda..0deb29b2 100644 --- a/ChocolArm64/Translation/ILEmitterCtx.cs +++ b/ChocolArm64/Translation/ILEmitterCtx.cs @@ -56,10 +56,10 @@ namespace ChocolArm64.Translation private OpCode64 _optOpLastCompare; private OpCode64 _optOpLastFlagSet; - //This is the index of the temporary register, used to store temporary - //values needed by some functions, since IL doesn't have a swap instruction. - //You can use any value here as long it doesn't conflict with the indices - //for the other registers. Any value >= 64 or < 0 will do. + // This is the index of the temporary register, used to store temporary + // values needed by some functions, since IL doesn't have a swap instruction. + // You can use any value here as long it doesn't conflict with the indices + // for the other registers. Any value >= 64 or < 0 will do. private const int ReservedLocalsCount = 64; private const int RorTmpIndex = ReservedLocalsCount + 0; @@ -69,7 +69,7 @@ namespace ChocolArm64.Translation private const int IntGpTmp2Index = ReservedLocalsCount + 4; private const int UserIntTempStart = ReservedLocalsCount + 5; - //Vectors are part of another "set" of locals. + // Vectors are part of another "set" of locals. private const int VecGpTmp1Index = ReservedLocalsCount + 0; private const int VecGpTmp2Index = ReservedLocalsCount + 1; private const int VecGpTmp3Index = ReservedLocalsCount + 2; @@ -139,10 +139,10 @@ namespace ChocolArm64.Translation public void ResetBlockStateForPredicatedOp() { - //Check if this is a predicated instruction that modifies flags, - //in this case the value of the flags is unknown as we don't know - //in advance if the instruction is going to be executed or not. - //So, we reset the block state to prevent an invalid optimization. + // Check if this is a predicated instruction that modifies flags, + // in this case the value of the flags is unknown as we don't know + // in advance if the instruction is going to be executed or not. + // So, we reset the block state to prevent an invalid optimization. if (CurrOp == _optOpLastFlagSet) { ResetBlockState(); @@ -167,8 +167,8 @@ namespace ChocolArm64.Translation public bool TryOptEmitSubroutineCall() { - //Calls should always have a next block, unless - //we're translating a single basic block. + // Calls should always have a next block, unless + // we're translating a single basic block. if (_currBlock.Next == null) { return false; @@ -239,15 +239,15 @@ namespace ChocolArm64.Translation && cond != Condition.GtUn && cond != Condition.LeUn) { - //There are several limitations that needs to be taken into account for CMN comparisons: - //- The unsigned comparisons are not valid, as they depend on the - //carry flag value, and they will have different values for addition and - //subtraction. For addition, it's carry, and for subtraction, it's borrow. - //So, we need to make sure we're not doing a unsigned compare for the CMN case. - //- We can only do the optimization for the immediate variants, - //because when the second operand value is exactly INT_MIN, we can't - //negate the value as theres no positive counterpart. - //Such invalid values can't be encoded on the immediate encodings. + // There are several limitations that needs to be taken into account for CMN comparisons: + // - The unsigned comparisons are not valid, as they depend on the + // carry flag value, and they will have different values for addition and + // subtraction. For addition, it's carry, and for subtraction, it's borrow. + // So, we need to make sure we're not doing a unsigned compare for the CMN case. + // - We can only do the optimization for the immediate variants, + // because when the second operand value is exactly INT_MIN, we can't + // negate the value as theres no positive counterpart. + // Such invalid values can't be encoded on the immediate encodings. if (_optOpLastCompare is IOpCodeAluImm64 op) { Ldloc(CmpOptTmp1Index, RegisterType.Int, _optOpLastCompare.RegisterSize); @@ -513,11 +513,11 @@ namespace ChocolArm64.Translation public void EmitLdflg(int index) => Ldloc(index, RegisterType.Flag); public void EmitStflg(int index) { - //Set this only if any of the NZCV flag bits were modified. - //This is used to ensure that when emiting a direct IL branch - //instruction for compare + branch sequences, we're not expecting - //to use comparison values from an old instruction, when in fact - //the flags were already overwritten by another instruction further along. + // Set this only if any of the NZCV flag bits were modified. + // This is used to ensure that when emiting a direct IL branch + // instruction for compare + branch sequences, we're not expecting + // to use comparison values from an old instruction, when in fact + // the flags were already overwritten by another instruction further along. if (index >= (int)PState.VBit) { _optOpLastFlagSet = CurrOp; diff --git a/ChocolArm64/Translation/RegisterUsage.cs b/ChocolArm64/Translation/RegisterUsage.cs index fe0c8659..f88fa0cd 100644 --- a/ChocolArm64/Translation/RegisterUsage.cs +++ b/ChocolArm64/Translation/RegisterUsage.cs @@ -153,7 +153,7 @@ namespace ChocolArm64.Translation public static long ClearCallerSavedIntRegs(long mask, ExecutionMode mode) { - //TODO: ARM32 support. + // TODO: ARM32 support. if (mode == ExecutionMode.Aarch64) { mask &= ~(CallerSavedIntRegistersMask | PStateNzcvFlagsMask); @@ -164,7 +164,7 @@ namespace ChocolArm64.Translation public static long ClearCallerSavedVecRegs(long mask, ExecutionMode mode) { - //TODO: ARM32 support. + // TODO: ARM32 support. if (mode == ExecutionMode.Aarch64) { mask &= ~CallerSavedVecRegistersMask; diff --git a/ChocolArm64/Translation/TranslatedSub.cs b/ChocolArm64/Translation/TranslatedSub.cs index 704e3b47..cf42e202 100644 --- a/ChocolArm64/Translation/TranslatedSub.cs +++ b/ChocolArm64/Translation/TranslatedSub.cs @@ -10,9 +10,9 @@ namespace ChocolArm64.Translation class TranslatedSub { - //This is the minimum amount of calls needed for the method - //to be retranslated with higher quality code. It's only worth - //doing that for hot code. + // This is the minimum amount of calls needed for the method + // to be retranslated with higher quality code. It's only worth + // doing that for hot code. private const int MinCallCountForOpt = 30; public ArmSubroutine Delegate { get; private set; } @@ -32,7 +32,7 @@ namespace ChocolArm64.Translation public TranslatedSub(DynamicMethod method, TranslationTier tier, bool rejit) { - Method = method ?? throw new ArgumentNullException(nameof(method));; + Method = method ?? throw new ArgumentNullException(nameof(method)); Tier = tier; _rejit = rejit; } @@ -74,7 +74,7 @@ namespace ChocolArm64.Translation public bool Rejit() { - if (!_rejit) + if (!_rejit) { return false; } @@ -84,7 +84,7 @@ namespace ChocolArm64.Translation return false; } - //Only return true once, so that it is added to the queue only once. + // Only return true once, so that it is added to the queue only once. _rejit = false; return true; diff --git a/ChocolArm64/Translation/Translator.cs b/ChocolArm64/Translation/Translator.cs index 2f88aaf9..0803df09 100644 --- a/ChocolArm64/Translation/Translator.cs +++ b/ChocolArm64/Translation/Translator.cs @@ -209,11 +209,11 @@ namespace ChocolArm64.Translation context.ResetBlockStateForPredicatedOp(); - //If this is the last op on the block, and there's no "next" block - //after this one, then we have to return right now, with the address - //of the next instruction to be executed (in the case that the condition - //is false, and the branch was not taken, as all basic blocks should end - //with some kind of branch). + // If this is the last op on the block, and there's no "next" block + // after this one, then we have to return right now, with the address + // of the next instruction to be executed (in the case that the condition + // is false, and the branch was not taken, as all basic blocks should end + // with some kind of branch). if (isLastOp && block.Next == null) { context.EmitStoreContext(); diff --git a/ChocolArm64/Translation/TranslatorCache.cs b/ChocolArm64/Translation/TranslatorCache.cs index d10d6757..cf6510ad 100644 --- a/ChocolArm64/Translation/TranslatorCache.cs +++ b/ChocolArm64/Translation/TranslatorCache.cs @@ -8,13 +8,13 @@ namespace ChocolArm64.Translation { class TranslatorCache { - //Maximum size of the cache, the unit used is completely arbitrary. + // Maximum size of the cache, the unit used is completely arbitrary. private const int MaxTotalSize = 0x800000; - //Minimum time required in milliseconds for a method to be eligible for deletion. + // Minimum time required in milliseconds for a method to be eligible for deletion. private const int MinTimeDelta = 2 * 60000; - //Minimum number of calls required to update the timestamp. + // Minimum number of calls required to update the timestamp. private const int MinCallCountForUpdate = 250; private class CacheBucket @@ -122,10 +122,10 @@ namespace ChocolArm64.Translation { try { - //The bucket value on the dictionary may have changed between the - //time we get the value from the dictionary, and we acquire the - //lock. So we need to ensure we are working with the latest value, - //we can do that by getting the value again, inside the lock. + // The bucket value on the dictionary may have changed between the + // time we get the value from the dictionary, and we acquire the + // lock. So we need to ensure we are working with the latest value, + // we can do that by getting the value again, inside the lock. if (_cache.TryGetValue(position, out CacheBucket latestBucket)) { latestBucket.CallCount = 0; diff --git a/Ryujinx.Audio/Renderers/DummyAudioOut.cs b/Ryujinx.Audio/Renderers/DummyAudioOut.cs index 5d6be3a3..56ae5d4f 100644 --- a/Ryujinx.Audio/Renderers/DummyAudioOut.cs +++ b/Ryujinx.Audio/Renderers/DummyAudioOut.cs @@ -32,7 +32,7 @@ namespace Ryujinx.Audio { int trackId; - if(!m_TrackIds.TryDequeue(out trackId)) + if (!m_TrackIds.TryDequeue(out trackId)) { trackId = ++lastTrackId; } @@ -57,7 +57,7 @@ namespace Ryujinx.Audio { m_Buffers.Enqueue(bufferTag); - if(m_ReleaseCallbacks.TryGetValue(trackID, out var callback)) + if (m_ReleaseCallbacks.TryGetValue(trackID, out var callback)) { callback?.Invoke(); } diff --git a/Ryujinx.Audio/Renderers/OpenAL/OpenALAudioOut.cs b/Ryujinx.Audio/Renderers/OpenAL/OpenALAudioOut.cs index 93f92879..6e085eed 100644 --- a/Ryujinx.Audio/Renderers/OpenAL/OpenALAudioOut.cs +++ b/Ryujinx.Audio/Renderers/OpenAL/OpenALAudioOut.cs @@ -124,10 +124,10 @@ namespace Ryujinx.Audio if (ReleasedCount > 0) { - //If we signal, then we also need to have released buffers available - //to return when GetReleasedBuffers is called. - //If playback needs to be re-started due to all buffers being processed, - //then OpenAL zeros the counts (ReleasedCount), so we keep it on the queue. + // If we signal, then we also need to have released buffers available + // to return when GetReleasedBuffers is called. + // If playback needs to be re-started due to all buffers being processed, + // then OpenAL zeros the counts (ReleasedCount), so we keep it on the queue. while (ReleasedCount-- > 0 && QueuedTagsQueue.TryDequeue(out long Tag)) { AL.SourceUnqueueBuffers(SourceId, 1); @@ -209,7 +209,7 @@ namespace Ryujinx.Audio } } - //If it's not slept it will waste cycles. + // If it's not slept it will waste cycles. Thread.Sleep(10); } while (KeepPolling); diff --git a/Ryujinx.Audio/Renderers/SoundIo/SoundIoAudioOut.cs b/Ryujinx.Audio/Renderers/SoundIo/SoundIoAudioOut.cs index 649aa8d7..f5e4c57d 100644 --- a/Ryujinx.Audio/Renderers/SoundIo/SoundIoAudioOut.cs +++ b/Ryujinx.Audio/Renderers/SoundIo/SoundIoAudioOut.cs @@ -138,7 +138,7 @@ namespace Ryujinx.Audio public void AppendBuffer(int trackId, long bufferTag, T[] buffer) where T : struct { - if(m_TrackPool.TryGet(trackId, out SoundIoAudioTrack track)) + if (m_TrackPool.TryGet(trackId, out SoundIoAudioTrack track)) { track.AppendBuffer(bufferTag, buffer); } @@ -201,12 +201,12 @@ namespace Ryujinx.Audio { SoundIODevice defaultAudioDevice = audioContext.GetOutputDevice(audioContext.DefaultOutputDeviceIndex); - if(!defaultAudioDevice.IsRaw) + if (!defaultAudioDevice.IsRaw) { return defaultAudioDevice; } - for(var i = 0; i < audioContext.BackendCount; i++) + for (int i = 0; i < audioContext.BackendCount; i++) { SoundIODevice audioDevice = audioContext.GetOutputDevice(i); @@ -242,26 +242,26 @@ namespace Ryujinx.Audio context.Connect(); context.FlushEvents(); - if(backendDisconnected) + if (backendDisconnected) { return false; } - if(context.OutputDeviceCount == 0) + if (context.OutputDeviceCount == 0) { return false; } device = FindNonRawDefaultAudioDevice(context); - if(device == null || backendDisconnected) + if (device == null || backendDisconnected) { return false; } stream = device.CreateOutStream(); - if(stream == null || backendDisconnected) + if (stream == null || backendDisconnected) { return false; } @@ -274,12 +274,12 @@ namespace Ryujinx.Audio } finally { - if(stream != null) + if (stream != null) { stream.Dispose(); } - if(context != null) + if (context != null) { context.Dispose(); } diff --git a/Ryujinx.Audio/Renderers/SoundIo/SoundIoAudioTrackPool.cs b/Ryujinx.Audio/Renderers/SoundIo/SoundIoAudioTrackPool.cs index ec256e20..95f181dc 100644 --- a/Ryujinx.Audio/Renderers/SoundIo/SoundIoAudioTrackPool.cs +++ b/Ryujinx.Audio/Renderers/SoundIo/SoundIoAudioTrackPool.cs @@ -140,7 +140,7 @@ namespace Ryujinx.Audio.SoundIo } /// - /// Attempers to get a from the pool + /// Attempts to get a from the pool /// /// The track retrieved from the pool /// True if retrieve was successful diff --git a/Ryujinx.Common/Logging/LogEventArgs.cs b/Ryujinx.Common/Logging/LogEventArgs.cs index 363a45b9..2330dedd 100644 --- a/Ryujinx.Common/Logging/LogEventArgs.cs +++ b/Ryujinx.Common/Logging/LogEventArgs.cs @@ -13,19 +13,19 @@ namespace Ryujinx.Common.Logging public LogEventArgs(LogLevel level, TimeSpan time, int threadId, string message) { - this.Level = level; - this.Time = time; - this.ThreadId = threadId; - this.Message = message; + Level = level; + Time = time; + ThreadId = threadId; + Message = message; } public LogEventArgs(LogLevel level, TimeSpan time, int threadId, string message, object data) { - this.Level = level; - this.Time = time; - this.ThreadId = threadId; - this.Message = message; - this.Data = data; + Level = level; + Time = time; + ThreadId = threadId; + Message = message; + Data = data; } } } \ No newline at end of file diff --git a/Ryujinx.Common/Pools/ObjectPool.cs b/Ryujinx.Common/Pools/ObjectPool.cs index dba671bb..e0bf5df6 100644 --- a/Ryujinx.Common/Pools/ObjectPool.cs +++ b/Ryujinx.Common/Pools/ObjectPool.cs @@ -19,7 +19,7 @@ namespace Ryujinx.Common public T Allocate() { - var instance = _firstItem; + T instance = _firstItem; if (instance == null || instance != Interlocked.CompareExchange(ref _firstItem, null, instance)) { @@ -31,11 +31,11 @@ namespace Ryujinx.Common private T AllocateInternal() { - var items = _items; + T[] items = _items; for (int i = 0; i < items.Length; i++) { - var instance = items[i]; + T instance = items[i]; if (instance != null && instance == Interlocked.CompareExchange(ref items[i], null, instance)) { @@ -60,7 +60,7 @@ namespace Ryujinx.Common private void ReleaseInternal(T obj) { - var items = _items; + T[] items = _items; for (int i = 0; i < items.Length; i++) { diff --git a/Ryujinx.Graphics/DmaPusher.cs b/Ryujinx.Graphics/DmaPusher.cs index c6825aba..74a32a4a 100644 --- a/Ryujinx.Graphics/DmaPusher.cs +++ b/Ryujinx.Graphics/DmaPusher.cs @@ -104,12 +104,12 @@ namespace Ryujinx.Graphics } else { - int sumissionMode = (word >> 29) & 7; + int submissionMode = (word >> 29) & 7; - switch (sumissionMode) + switch (submissionMode) { case 1: - //Incrementing. + // Incrementing. SetNonImmediateState(word); _state.NonIncrementing = false; @@ -118,7 +118,7 @@ namespace Ryujinx.Graphics break; case 3: - //Non-incrementing. + // Non-incrementing. SetNonImmediateState(word); _state.NonIncrementing = true; @@ -127,7 +127,7 @@ namespace Ryujinx.Graphics break; case 4: - //Immediate. + // Immediate. _state.Method = (word >> 0) & 0x1fff; _state.SubChannel = (word >> 13) & 7; _state.NonIncrementing = true; @@ -138,7 +138,7 @@ namespace Ryujinx.Graphics break; case 5: - //Increment-once. + // Increment-once. SetNonImmediateState(word); _state.NonIncrementing = false; diff --git a/Ryujinx.Graphics/Gal/GalImageFormat.cs b/Ryujinx.Graphics/Gal/GalImageFormat.cs index 8dcde182..19ce6cfc 100644 --- a/Ryujinx.Graphics/Gal/GalImageFormat.cs +++ b/Ryujinx.Graphics/Gal/GalImageFormat.cs @@ -1,4 +1,5 @@ -using System; +// ReSharper disable InconsistentNaming +using System; namespace Ryujinx.Graphics.Gal { diff --git a/Ryujinx.Graphics/Gal/GalVertexBinding.cs b/Ryujinx.Graphics/Gal/GalVertexBinding.cs index 0c3c845d..2337c2e3 100644 --- a/Ryujinx.Graphics/Gal/GalVertexBinding.cs +++ b/Ryujinx.Graphics/Gal/GalVertexBinding.cs @@ -2,7 +2,7 @@ namespace Ryujinx.Graphics.Gal { public struct GalVertexBinding { - //VboKey shouldn't be here, but ARB_vertex_attrib_binding is core since 4.3 + // VboKey shouldn't be here, but ARB_vertex_attrib_binding is core since 4.3 public bool Enabled; public int Stride; diff --git a/Ryujinx.Graphics/Gal/OpenGL/OglEnumConverter.cs b/Ryujinx.Graphics/Gal/OpenGL/OglEnumConverter.cs index a3f9957f..c36d8bf9 100644 --- a/Ryujinx.Graphics/Gal/OpenGL/OglEnumConverter.cs +++ b/Ryujinx.Graphics/Gal/OpenGL/OglEnumConverter.cs @@ -275,7 +275,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL } else { - //Fallback to non-mirrored clamps + // Fallback to non-mirrored clamps switch (wrap) { case GalTextureWrap.MirrorClampToEdge: return TextureWrapMode.ClampToEdge; @@ -291,7 +291,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL GalTextureFilter minFilter, GalTextureMipFilter mipFilter) { - //TODO: Mip (needs mipmap support first). + // TODO: Mip (needs mipmap support first). switch (minFilter) { case GalTextureFilter.Nearest: return TextureMinFilter.Nearest; diff --git a/Ryujinx.Graphics/Gal/OpenGL/OglPipeline.cs b/Ryujinx.Graphics/Gal/OpenGL/OglPipeline.cs index 64768e28..8d886be4 100644 --- a/Ryujinx.Graphics/Gal/OpenGL/OglPipeline.cs +++ b/Ryujinx.Graphics/Gal/OpenGL/OglPipeline.cs @@ -96,7 +96,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL _rasterizer = rasterizer; _shader = shader; - //These values match OpenGL's defaults + // These values match OpenGL's defaults _old = new GalPipelineState { FrontFace = GalFrontFace.Ccw, @@ -564,14 +564,14 @@ namespace Ryujinx.Graphics.Gal.OpenGL { _vaoHandle = GL.GenVertexArray(); - //Vertex arrays shouldn't be used anywhere else in OpenGL's backend - //if you want to use it, move this line out of the if + // Vertex arrays shouldn't be used anywhere else in OpenGL's backend + // if you want to use it, move this line out of the if GL.BindVertexArray(_vaoHandle); } foreach (GalVertexAttrib attrib in binding.Attribs) { - //Skip uninitialized attributes. + // Skip uninitialized attributes. if (attrib.Size == 0) { continue; diff --git a/Ryujinx.Graphics/Gal/OpenGL/OglRenderTarget.cs b/Ryujinx.Graphics/Gal/OpenGL/OglRenderTarget.cs index d36bac1b..11fc98cb 100644 --- a/Ryujinx.Graphics/Gal/OpenGL/OglRenderTarget.cs +++ b/Ryujinx.Graphics/Gal/OpenGL/OglRenderTarget.cs @@ -77,11 +77,11 @@ namespace Ryujinx.Graphics.Gal.OpenGL private int _cropRight; private int _cropBottom; - //This framebuffer is used to attach guest rendertargets, - //think of it as a dummy OpenGL VAO + // This framebuffer is used to attach guest rendertargets, + // think of it as a dummy OpenGL VAO private int _dummyFrameBuffer; - //These framebuffers are used to blit images + // These framebuffers are used to blit images private int _srcFb; private int _dstFb; @@ -109,8 +109,8 @@ namespace Ryujinx.Graphics.Gal.OpenGL private void TextureDeletionHandler(object sender, int handle) { - //Texture was deleted, the handle is no longer valid, so - //reset all uses of this handle on a render target. + // Texture was deleted, the handle is no longer valid, so + // reset all uses of this handle on a render target. for (int attachment = 0; attachment < RenderTargetsCount; attachment++) { if (_colorHandles[attachment] == handle) @@ -484,7 +484,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL GL.BindBuffer(BufferTarget.PixelPackBuffer, _copyPbo); - //The buffer should be large enough to hold the largest texture. + // The buffer should be large enough to hold the largest texture. int bufferSize = Math.Max(ImageUtils.GetSize(oldImage), ImageUtils.GetSize(newImage)); diff --git a/Ryujinx.Graphics/Gal/OpenGL/OglShader.cs b/Ryujinx.Graphics/Gal/OpenGL/OglShader.cs index 8f4072c5..8da0104e 100644 --- a/Ryujinx.Graphics/Gal/OpenGL/OglShader.cs +++ b/Ryujinx.Graphics/Gal/OpenGL/OglShader.cs @@ -115,7 +115,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL data[1] = flipY; data[2] = BitConverter.Int32BitsToSingle(instance); - //Invalidate buffer + // Invalidate buffer GL.BufferData(BufferTarget.UniformBuffer, ExtraDataSize * sizeof(float), IntPtr.Zero, BufferUsageHint.StreamDraw); GL.BufferSubData(BufferTarget.UniformBuffer, IntPtr.Zero, ExtraDataSize * sizeof(float), (IntPtr)data); @@ -228,9 +228,9 @@ namespace Ryujinx.Graphics.Gal.OpenGL if (blockIndex < 0) { - //This may be fine, the compiler may optimize away unused uniform buffers, - //and in this case the above call would return -1 as the buffer has been - //optimized away. + // This may be fine, the compiler may optimize away unused uniform buffers, + // and in this case the above call would return -1 as the buffer has been + // optimized away. continue; } diff --git a/Ryujinx.Graphics/Gal/OpenGL/OglTexture.cs b/Ryujinx.Graphics/Gal/OpenGL/OglTexture.cs index b6bf36c5..b5ac6692 100644 --- a/Ryujinx.Graphics/Gal/OpenGL/OglTexture.cs +++ b/Ryujinx.Graphics/Gal/OpenGL/OglTexture.cs @@ -207,7 +207,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL } else { - //TODO: Use KHR_texture_compression_astc_hdr when available + // TODO: Use KHR_texture_compression_astc_hdr when available if (IsAstc(image.Format)) { int textureBlockWidth = ImageUtils.GetBlockWidth(image.Format); diff --git a/Ryujinx.Graphics/Gal/ShaderDumper.cs b/Ryujinx.Graphics/Gal/ShaderDumper.cs index 726447e4..e25127de 100644 --- a/Ryujinx.Graphics/Gal/ShaderDumper.cs +++ b/Ryujinx.Graphics/Gal/ShaderDumper.cs @@ -38,7 +38,7 @@ namespace Ryujinx.Graphics.Gal ulong instruction = 0; - //Dump until a NOP instruction is found + // Dump until a NOP instruction is found while ((instruction >> 48 & 0xfff8) != 0x50b0) { uint word0 = (uint)memory.ReadInt32(position + 0x50 + offset + 0); @@ -46,8 +46,8 @@ namespace Ryujinx.Graphics.Gal instruction = word0 | (ulong)word1 << 32; - //Zero instructions (other kind of NOP) stop immediatly, - //this is to avoid two rows of zeroes + // Zero instructions (other kind of NOP) stop immediately, + // this is to avoid two rows of zeroes if (instruction == 0) { break; @@ -59,7 +59,7 @@ namespace Ryujinx.Graphics.Gal offset += 8; } - //Align to meet nvdisasm requeriments + // Align to meet nvdisasm requirements while (offset % 0x20 != 0) { fullWriter.Write(0); diff --git a/Ryujinx.Graphics/GpuResourceManager.cs b/Ryujinx.Graphics/GpuResourceManager.cs index 740e6be8..16e9f579 100644 --- a/Ryujinx.Graphics/GpuResourceManager.cs +++ b/Ryujinx.Graphics/GpuResourceManager.cs @@ -109,7 +109,7 @@ namespace Ryujinx.Graphics { if (oldType == ImageType.ColorBuffer || oldType == ImageType.ZetaBuffer) { - //Avoid data destruction + // Avoid data destruction MemoryRegionModified(vmm, position, size, NvGpuBufferType.Texture); skipCheck = true; diff --git a/Ryujinx.Graphics/Graphics3d/MacroInterpreter.cs b/Ryujinx.Graphics/Graphics3d/MacroInterpreter.cs index 84576213..9a6206fa 100644 --- a/Ryujinx.Graphics/Graphics3d/MacroInterpreter.cs +++ b/Ryujinx.Graphics/Graphics3d/MacroInterpreter.cs @@ -82,8 +82,8 @@ namespace Ryujinx.Graphics.Graphics3d while (Step(vmm, mme)); - //Due to the delay slot, we still need to execute - //one more instruction before we actually exit. + // Due to the delay slot, we still need to execute + // one more instruction before we actually exit. Step(vmm, mme); } @@ -108,14 +108,14 @@ namespace Ryujinx.Graphics.Graphics3d if ((_opCode & 7) < 7) { - //Operation produces a value. + // Operation produces a value. AssignmentOperation asgOp = (AssignmentOperation)((_opCode >> 4) & 7); int result = GetAluResult(); switch (asgOp) { - //Fetch parameter and ignore result. + // Fetch parameter and ignore result. case AssignmentOperation.IgnoreAndFetch: { SetDstGpr(FetchParam()); @@ -123,7 +123,7 @@ namespace Ryujinx.Graphics.Graphics3d break; } - //Move result. + // Move result. case AssignmentOperation.Move: { SetDstGpr(result); @@ -131,7 +131,7 @@ namespace Ryujinx.Graphics.Graphics3d break; } - //Move result and use as Method Address. + // Move result and use as Method Address. case AssignmentOperation.MoveAndSetMaddr: { SetDstGpr(result); @@ -141,7 +141,7 @@ namespace Ryujinx.Graphics.Graphics3d break; } - //Fetch parameter and send result. + // Fetch parameter and send result. case AssignmentOperation.FetchAndSend: { SetDstGpr(FetchParam()); @@ -151,7 +151,7 @@ namespace Ryujinx.Graphics.Graphics3d break; } - //Move and send result. + // Move and send result. case AssignmentOperation.MoveAndSend: { SetDstGpr(result); @@ -161,7 +161,7 @@ namespace Ryujinx.Graphics.Graphics3d break; } - //Fetch parameter and use result as Method Address. + // Fetch parameter and use result as Method Address. case AssignmentOperation.FetchAndSetMaddr: { SetDstGpr(FetchParam()); @@ -171,7 +171,7 @@ namespace Ryujinx.Graphics.Graphics3d break; } - //Move result and use as Method Address, then fetch and send paramter. + // Move result and use as Method Address, then fetch and send parameter. case AssignmentOperation.MoveAndSetMaddrThenFetchAndSend: { SetDstGpr(result); @@ -183,7 +183,7 @@ namespace Ryujinx.Graphics.Graphics3d break; } - //Move result and use as Method Address, then send bits 17:12 of result. + // Move result and use as Method Address, then send bits 17:12 of result. case AssignmentOperation.MoveAndSetMaddrThenSendHigh: { SetDstGpr(result); @@ -198,7 +198,7 @@ namespace Ryujinx.Graphics.Graphics3d } else { - //Branch. + // Branch. bool onNotZero = ((_opCode >> 4) & 1) != 0; bool taken = onNotZero @@ -355,7 +355,7 @@ namespace Ryujinx.Graphics.Graphics3d private int GetImm() { - //Note: The immediate is signed, the sign-extension is intended here. + // Note: The immediate is signed, the sign-extension is intended here. return _opCode >> 14; } diff --git a/Ryujinx.Graphics/Graphics3d/NvGpuEngine2d.cs b/Ryujinx.Graphics/Graphics3d/NvGpuEngine2d.cs index d42dca28..b6dae2a3 100644 --- a/Ryujinx.Graphics/Graphics3d/NvGpuEngine2d.cs +++ b/Ryujinx.Graphics/Graphics3d/NvGpuEngine2d.cs @@ -204,10 +204,10 @@ namespace Ryujinx.Graphics.Graphics3d dstBlitX + dstBlitW, dstBlitY + dstBlitH); - //Do a guest side copy aswell. This is necessary when - //the texture is modified by the guest, however it doesn't - //work when resources that the gpu can write to are copied, - //like framebuffers. + // Do a guest side copy as well. This is necessary when + // the texture is modified by the guest, however it doesn't + // work when resources that the gpu can write to are copied, + // like framebuffers. // FIXME: SUPPORT MULTILAYER CORRECTLY HERE (this will cause weird stuffs on the first layer) ImageUtils.CopyTexture( diff --git a/Ryujinx.Graphics/Graphics3d/NvGpuEngine3d.cs b/Ryujinx.Graphics/Graphics3d/NvGpuEngine3d.cs index 29b6cc5d..e475a964 100644 --- a/Ryujinx.Graphics/Graphics3d/NvGpuEngine3d.cs +++ b/Ryujinx.Graphics/Graphics3d/NvGpuEngine3d.cs @@ -67,8 +67,8 @@ namespace Ryujinx.Graphics.Graphics3d _constBuffers[index] = new ConstBuffer[18]; } - //Ensure that all components are enabled by default. - //FIXME: Is this correct? + // Ensure that all components are enabled by default. + // FIXME: Is this correct? WriteRegister(NvGpuEngine3dReg.ColorMaskN, 0x1111); WriteRegister(NvGpuEngine3dReg.FrameBufferSrgb, 1); @@ -333,12 +333,12 @@ namespace Ryujinx.Graphics.Graphics3d if (vpAEnable) { - //Note: The maxwell supports 2 vertex programs, usually - //only VP B is used, but in some cases VP A is also used. - //In this case, it seems to function as an extra vertex - //shader stage. - //The graphics abstraction layer has a special overload for this - //case, which should merge the two shaders into one vertex shader. + // Note: The maxwell supports 2 vertex programs, usually + // only VP B is used, but in some cases VP A is also used. + // In this case, it seems to function as an extra vertex + // shader stage. + // The graphics abstraction layer has a special overload for this + // case, which should merge the two shaders into one vertex shader. int vpAOffset = ReadRegister(NvGpuEngine3dReg.ShaderNOffset); int vpBOffset = ReadRegister(NvGpuEngine3dReg.ShaderNOffset + 0x10); @@ -360,7 +360,7 @@ namespace Ryujinx.Graphics.Graphics3d int control = ReadRegister(NvGpuEngine3dReg.ShaderNControl + index * 0x10); int offset = ReadRegister(NvGpuEngine3dReg.ShaderNOffset + index * 0x10); - //Note: Vertex Program (B) is always enabled. + // Note: Vertex Program (B) is always enabled. bool enable = (control & 1) != 0 || index == 1; if (!enable) @@ -405,7 +405,7 @@ namespace Ryujinx.Graphics.Graphics3d GalFrontFace frontFace = (GalFrontFace)ReadRegister(NvGpuEngine3dReg.FrontFace); - //Flipping breaks facing. Flipping front facing too fixes it + // Flipping breaks facing. Flipping front facing too fixes it if (signX != signY) { switch (frontFace) @@ -574,8 +574,8 @@ namespace Ryujinx.Graphics.Graphics3d } else { - //It seems that even when independent blend is disabled, the first IBlend enable - //register is still set to indicate whenever blend is enabled or not (?). + // It seems that even when independent blend is disabled, the first IBlend enable + // register is still set to indicate whenever blend is enabled or not (?). state.Blends[index].Enabled = ReadRegisterBool(NvGpuEngine3dReg.IBlendNEnable); if (state.Blends[index].Enabled) @@ -632,8 +632,8 @@ namespace Ryujinx.Graphics.Graphics3d private void SetRenderTargets() { - //Commercial games do not seem to - //bool SeparateFragData = ReadRegisterBool(NvGpuEngine3dReg.RTSeparateFragData); + // Commercial games do not seem to + // bool SeparateFragData = ReadRegisterBool(NvGpuEngine3dReg.RTSeparateFragData); uint control = (uint)(ReadRegister(NvGpuEngine3dReg.RtControl)); @@ -711,8 +711,8 @@ namespace Ryujinx.Graphics.Graphics3d { if (textureHandle == 0) { - //FIXME: Some games like puyo puyo will use handles with the value 0. - //This is a bug, most likely caused by sync issues. + // FIXME: Some games like puyo puyo will use handles with the value 0. + // This is a bug, most likely caused by sync issues. return (0, default(GalImage), default(GalTextureSampler)); } @@ -751,7 +751,7 @@ namespace Ryujinx.Graphics.Graphics3d { Profile.End(Profiles.GPU.Engine3d.UploadTexture); - //FIXME: Shouldn't ignore invalid addresses. + // FIXME: Shouldn't ignore invalid addresses. return (0, default(GalImage), default(GalTextureSampler)); } @@ -910,8 +910,8 @@ namespace Ryujinx.Graphics.Graphics3d // Check vertex array is enabled to avoid out of bounds exception when reading bytes bool enable = (ReadRegister(NvGpuEngine3dReg.VertexArrayNControl + arrayIndex * 4) & 0x1000) != 0; - //Note: 16 is the maximum size of an attribute, - //having a component size of 32-bits with 4 elements (a vec4). + // Note: 16 is the maximum size of an attribute, + // having a component size of 32-bits with 4 elements (a vec4). if (enable) { byte[] data = vmm.ReadBytes(vbPosition + offset, 16); @@ -954,7 +954,7 @@ namespace Ryujinx.Graphics.Graphics3d if (vbPosition > vbEndPos) { - //Instance is invalid, ignore the draw call + // Instance is invalid, ignore the draw call continue; } @@ -1057,14 +1057,14 @@ namespace Ryujinx.Graphics.Graphics3d long iboKey = vmm.GetPhysicalAddress(indexPosition); - //Quad primitive types were deprecated on OpenGL 3.x, - //they are converted to a triangles index buffer on IB creation, - //so we should use the triangles type here too. + // Quad primitive types were deprecated on OpenGL 3.x, + // they are converted to a triangles index buffer on IB creation, + // so we should use the triangles type here too. if (primType == GalPrimitiveType.Quads || primType == GalPrimitiveType.QuadStrip) { - //Note: We assume that index first points to the first - //vertex of a quad, if it points to the middle of a - //quad (First % 4 != 0 for Quads) then it will not work properly. + // Note: We assume that index first points to the first + // vertex of a quad, if it points to the middle of a + // quad (First % 4 != 0 for Quads) then it will not work properly. if (primType == GalPrimitiveType.Quads) { indexFirst = QuadHelper.ConvertSizeQuadsToTris(indexFirst); @@ -1084,14 +1084,14 @@ namespace Ryujinx.Graphics.Graphics3d int vertexFirst = ReadRegister(NvGpuEngine3dReg.VertexArrayFirst); int vertexCount = ReadRegister(NvGpuEngine3dReg.VertexArrayCount); - //Quad primitive types were deprecated on OpenGL 3.x, - //they are converted to a triangles index buffer on IB creation, - //so we should use the triangles type here too. + // Quad primitive types were deprecated on OpenGL 3.x, + // they are converted to a triangles index buffer on IB creation, + // so we should use the triangles type here too. if (primType == GalPrimitiveType.Quads || primType == GalPrimitiveType.QuadStrip) { - //Note: We assume that index first points to the first - //vertex of a quad, if it points to the middle of a - //quad (First % 4 != 0 for Quads) then it will not work properly. + // Note: We assume that index first points to the first + // vertex of a quad, if it points to the middle of a + // quad (First % 4 != 0 for Quads) then it will not work properly. if (primType == GalPrimitiveType.Quads) { vertexFirst = QuadHelper.ConvertSizeQuadsToTris(vertexFirst); @@ -1111,7 +1111,7 @@ namespace Ryujinx.Graphics.Graphics3d // Reset pipeline for host OpenGL calls _gpu.Renderer.Pipeline.Unbind(state); - //Is the GPU really clearing those registers after draw? + // Is the GPU really clearing those registers after draw? WriteRegister(NvGpuEngine3dReg.IndexBatchFirst, 0); WriteRegister(NvGpuEngine3dReg.IndexBatchCount, 0); } @@ -1140,7 +1140,7 @@ namespace Ryujinx.Graphics.Graphics3d case QueryMode.WriteCounterAndTimestamp: { - //TODO: Implement counters. + // TODO: Implement counters. long counter = 1; long timestamp = PerformanceCounter.ElapsedMilliseconds; diff --git a/Ryujinx.Graphics/Graphics3d/NvGpuEngineM2mf.cs b/Ryujinx.Graphics/Graphics3d/NvGpuEngineM2mf.cs index 172c919b..fca8ae22 100644 --- a/Ryujinx.Graphics/Graphics3d/NvGpuEngineM2mf.cs +++ b/Ryujinx.Graphics/Graphics3d/NvGpuEngineM2mf.cs @@ -56,7 +56,7 @@ namespace Ryujinx.Graphics.Graphics3d { Profile.Begin(Profiles.GPU.EngineM2mf.Execute); - //TODO: Some registers and copy modes are still not implemented. + // TODO: Some registers and copy modes are still not implemented. int control = methCall.Argument; bool srcLinear = ((control >> 7) & 1) != 0; diff --git a/Ryujinx.Graphics/Graphics3d/NvGpuEngineP2mf.cs b/Ryujinx.Graphics/Graphics3d/NvGpuEngineP2mf.cs index 83ad0e70..2b2c7b5f 100644 --- a/Ryujinx.Graphics/Graphics3d/NvGpuEngineP2mf.cs +++ b/Ryujinx.Graphics/Graphics3d/NvGpuEngineP2mf.cs @@ -73,7 +73,7 @@ namespace Ryujinx.Graphics.Graphics3d { Profile.Begin(Profiles.GPU.EngineP2mf.Execute); - //TODO: Some registers and copy modes are still not implemented. + // TODO: Some registers and copy modes are still not implemented. int control = methCall.Argument; long dstAddress = MakeInt64From2xInt32(NvGpuEngineP2mfReg.DstAddress); diff --git a/Ryujinx.Graphics/Graphics3d/NvGpuFifo.cs b/Ryujinx.Graphics/Graphics3d/NvGpuFifo.cs index ae96a4f5..23bfd0b3 100644 --- a/Ryujinx.Graphics/Graphics3d/NvGpuFifo.cs +++ b/Ryujinx.Graphics/Graphics3d/NvGpuFifo.cs @@ -7,8 +7,8 @@ namespace Ryujinx.Graphics.Graphics3d private const int MacrosCount = 0x80; private const int MacroIndexMask = MacrosCount - 1; - //Note: The size of the macro memory is unknown, we just make - //a guess here and use 256kb as the size. Increase if needed. + // Note: The size of the macro memory is unknown, we just make + // a guess here and use 256kb as the size. Increase if needed. private const int MmeWords = 256 * 256; private NvGpu _gpu; diff --git a/Ryujinx.Graphics/Graphics3d/Texture/AstcDecoder.cs b/Ryujinx.Graphics/Graphics3d/Texture/AstcDecoder.cs index 99b166f3..3e68be7d 100644 --- a/Ryujinx.Graphics/Graphics3d/Texture/AstcDecoder.cs +++ b/Ryujinx.Graphics/Graphics3d/Texture/AstcDecoder.cs @@ -11,7 +11,7 @@ namespace Ryujinx.Graphics.Texture public AstcDecoderException(string exMsg) : base(exMsg) { } } - //https://github.com/GammaUNC/FasTC/blob/master/ASTCEncoder/src/Decompressor.cpp + // https://github.com/GammaUNC/FasTC/blob/master/ASTCEncoder/src/Decompressor.cpp public static class AstcDecoder { struct TexelWeightParams @@ -1356,7 +1356,7 @@ namespace Ryujinx.Graphics.Texture } default: - //Don't know this layout... + // Don't know this layout... texelParams.Error = true; break; } diff --git a/Ryujinx.Graphics/Graphics3d/Texture/AstcPixel.cs b/Ryujinx.Graphics/Graphics3d/Texture/AstcPixel.cs index cd30acca..2f73c62b 100644 --- a/Ryujinx.Graphics/Graphics3d/Texture/AstcPixel.cs +++ b/Ryujinx.Graphics/Graphics3d/Texture/AstcPixel.cs @@ -65,7 +65,7 @@ namespace Ryujinx.Graphics.Texture public void ChangeBitDepth(byte[] depth) { - for(int i = 0; i< 4; i++) + for (int i = 0; i< 4; i++) { int value = ChangeBitDepth(GetComponent(i), _bitDepth[i], depth[i]); diff --git a/Ryujinx.Graphics/Graphics3d/Texture/ImageUtils.cs b/Ryujinx.Graphics/Graphics3d/Texture/ImageUtils.cs index bd9b4327..2e78cf14 100644 --- a/Ryujinx.Graphics/Graphics3d/Texture/ImageUtils.cs +++ b/Ryujinx.Graphics/Graphics3d/Texture/ImageUtils.cs @@ -67,7 +67,7 @@ namespace Ryujinx.Graphics.Texture { GalTextureFormat.D32Fx24S8, GalImageFormat.D32S8 | Float }, { GalTextureFormat.D16, GalImageFormat.D16 | Unorm }, - //Compressed formats + // Compressed formats { GalTextureFormat.BptcSfloat, GalImageFormat.BptcSfloat | Float }, { GalTextureFormat.BptcUfloat, GalImageFormat.BptcUfloat | Float }, { GalTextureFormat.BptcUnorm, GalImageFormat.BptcUnorm | Unorm | Srgb }, @@ -248,7 +248,7 @@ namespace Ryujinx.Graphics.Texture int bytesPerPixel = desc.BytesPerPixel; - //Note: Each row of the texture needs to be aligned to 4 bytes. + // Note: Each row of the texture needs to be aligned to 4 bytes. int pitch = (width * bytesPerPixel + 3) & ~3; diff --git a/Ryujinx.Graphics/Memory/NvGpuVmm.cs b/Ryujinx.Graphics/Memory/NvGpuVmm.cs index ac1b765a..fea99587 100644 --- a/Ryujinx.Graphics/Memory/NvGpuVmm.cs +++ b/Ryujinx.Graphics/Memory/NvGpuVmm.cs @@ -146,8 +146,8 @@ namespace Ryujinx.Graphics.Memory private long GetFreePosition(long size, long align = 1, long start = 1L << 32) { - //Note: Address 0 is not considered valid by the driver, - //when 0 is returned it's considered a mapping error. + // Note: Address 0 is not considered valid by the driver, + // when 0 is returned it's considered a mapping error. long position = start; long freeSize = 0; diff --git a/Ryujinx.Graphics/QuadHelper.cs b/Ryujinx.Graphics/QuadHelper.cs index 49c679e3..643084ba 100644 --- a/Ryujinx.Graphics/QuadHelper.cs +++ b/Ryujinx.Graphics/QuadHelper.cs @@ -33,13 +33,13 @@ namespace Ryujinx.Graphics Buffer.BlockCopy(data, src, output, dst, copyCount * entrySize); } - //0 1 2 -> 0 1 2. + // 0 1 2 -> 0 1 2. AssignIndex(0, 0, 3); - //2 3 -> 3 4. + // 2 3 -> 3 4. AssignIndex(2, 3, 2); - //0 -> 5. + // 0 -> 5. AssignIndex(0, 5); } @@ -65,13 +65,13 @@ namespace Ryujinx.Graphics Buffer.BlockCopy(data, src, output, dst, copyCount * entrySize); } - //-2 -1 0 -> 0 1 2. + // -2 -1 0 -> 0 1 2. AssignIndex(-2, 0, 3); - //0 1 -> 3 4. + // 0 1 -> 3 4. AssignIndex(0, 3, 2); - //-2 -> 5. + // -2 -> 5. AssignIndex(-2, 5); } diff --git a/Ryujinx.Graphics/Shader/CodeGen/Glsl/CodeGenContext.cs b/Ryujinx.Graphics/Shader/CodeGen/Glsl/CodeGenContext.cs index ce5d7b94..dcbdc309 100644 --- a/Ryujinx.Graphics/Shader/CodeGen/Glsl/CodeGenContext.cs +++ b/Ryujinx.Graphics/Shader/CodeGen/Glsl/CodeGenContext.cs @@ -18,7 +18,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl private int _level; - private string _identation; + private string _indentation; public CodeGenContext(ShaderConfig config) { @@ -39,7 +39,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl public void AppendLine(string str) { - _sb.AppendLine(_identation + str); + _sb.AppendLine(_indentation + str); } public string GetCode() @@ -53,7 +53,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl _level++; - UpdateIdentation(); + UpdateIndentation(); } public void LeaveScope(string suffix = "") @@ -65,26 +65,26 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl _level--; - UpdateIdentation(); + UpdateIndentation(); AppendLine("}" + suffix); } - private void UpdateIdentation() + private void UpdateIndentation() { - _identation = GetIdentation(_level); + _indentation = GetIndentation(_level); } - private static string GetIdentation(int level) + private static string GetIndentation(int level) { - string identation = string.Empty; + string indentation = string.Empty; for (int index = 0; index < level; index++) { - identation += Tab; + indentation += Tab; } - return identation; + return indentation; } } } \ No newline at end of file diff --git a/Ryujinx.Graphics/Shader/CodeGen/Glsl/Instructions/InstGenHelper.cs b/Ryujinx.Graphics/Shader/CodeGen/Glsl/Instructions/InstGenHelper.cs index 0b860072..9855cd91 100644 --- a/Ryujinx.Graphics/Shader/CodeGen/Glsl/Instructions/InstGenHelper.cs +++ b/Ryujinx.Graphics/Shader/CodeGen/Glsl/Instructions/InstGenHelper.cs @@ -112,13 +112,13 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions public static bool NeedsParenthesis(IAstNode node, Instruction pInst, InstInfo pInfo, bool isLhs) { - //If the node isn't a operation, then it can only be a operand, - //and those never needs to be surrounded in parenthesis. + // If the node isn't a operation, then it can only be a operand, + // and those never needs to be surrounded in parenthesis. if (!(node is AstOperation operation)) { - //This is sort of a special case, if this is a negative constant, - //and it is consumed by a unary operation, we need to put on the parenthesis, - //as in GLSL a sequence like --2 or ~-1 is not valid. + // This is sort of a special case, if this is a negative constant, + // and it is consumed by a unary operation, we need to put on the parenthesis, + // as in GLSL a sequence like --2 or ~-1 is not valid. if (IsNegativeConst(node) && pInfo.Type == InstType.OpUnary) { return true; diff --git a/Ryujinx.Graphics/Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs b/Ryujinx.Graphics/Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs index 79f80057..8b5257fc 100644 --- a/Ryujinx.Graphics/Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs +++ b/Ryujinx.Graphics/Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs @@ -69,8 +69,8 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions arrayIndexElem = pCount++; } - //The sampler 1D shadow overload expects a - //dummy value on the middle of the vector, who knows why... + // The sampler 1D shadow overload expects a + // dummy value on the middle of the vector, who knows why... bool hasDummy1DShadowElem = texOp.Type == (TextureType.Texture1D | TextureType.Shadow); if (hasDummy1DShadowElem) @@ -83,8 +83,8 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions pCount++; } - //On textureGather*, the comparison value is - //always specified as an extra argument. + // On textureGather*, the comparison value is + // always specified as an extra argument. bool hasExtraCompareArg = isShadow && isGather; if (pCount == 5) @@ -199,8 +199,8 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions Append(Src(VariableType.F32)); } - //textureGather* optional extra component index, - //not needed for shadow samplers. + // textureGather* optional extra component index, + // not needed for shadow samplers. if (isGather && !isShadow) { Append(Src(VariableType.S32)); diff --git a/Ryujinx.Graphics/Shader/CodeGen/Glsl/Instructions/InstType.cs b/Ryujinx.Graphics/Shader/CodeGen/Glsl/Instructions/InstType.cs index 7d38a9d2..121cd079 100644 --- a/Ryujinx.Graphics/Shader/CodeGen/Glsl/Instructions/InstType.cs +++ b/Ryujinx.Graphics/Shader/CodeGen/Glsl/Instructions/InstType.cs @@ -9,7 +9,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions OpUnary = Op | 1, OpBinary = Op | 2, OpTernary = Op | 3, - OpBinaryCom = OpBinary | Comutative, + OpBinaryCom = OpBinary | Commutative, CallNullary = Call | 0, CallUnary = Call | 1, @@ -17,10 +17,10 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions CallTernary = Call | 3, CallQuaternary = Call | 4, - Comutative = 1 << 8, - Op = 1 << 9, - Call = 1 << 10, - Special = 1 << 11, + Commutative = 1 << 8, + Op = 1 << 9, + Call = 1 << 10, + Special = 1 << 11, ArityMask = 0xff } diff --git a/Ryujinx.Graphics/Shader/CodeGen/Glsl/OperandManager.cs b/Ryujinx.Graphics/Shader/CodeGen/Glsl/OperandManager.cs index 9aed8eb8..19f7185e 100644 --- a/Ryujinx.Graphics/Shader/CodeGen/Glsl/OperandManager.cs +++ b/Ryujinx.Graphics/Shader/CodeGen/Glsl/OperandManager.cs @@ -102,9 +102,9 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl public static string GetConstantBufferName(IAstNode slot, string offsetExpr, GalShaderType shaderType) { - //Non-constant slots are not supported. - //It is expected that upstream stages are never going to generate non-constant - //slot access. + // Non-constant slots are not supported. + // It is expected that upstream stages are never going to generate non-constant + // slot access. AstOperand operand = (AstOperand)slot; string ubName = GetUbName(shaderType, operand.Value); @@ -157,7 +157,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl } else if (_builtInAttributes.TryGetValue(value & ~3, out BuiltInAttribute builtInAttr)) { - //TODO: There must be a better way to handle this... + // TODO: There must be a better way to handle this... if (shaderType == GalShaderType.Fragment) { switch (value & ~3) @@ -180,14 +180,14 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl } } - //TODO: Warn about unknown built-in attribute. + // TODO: Warn about unknown built-in attribute. return isOutAttr ? "// bad_attr0x" + value.ToString("X") : "0.0"; } public static string GetUbName(GalShaderType shaderType, int slot) { - string ubName = OperandManager.GetShaderStagePrefix(shaderType); + string ubName = GetShaderStagePrefix(shaderType); ubName += "_" + DefaultNames.UniformNamePrefix + slot; diff --git a/Ryujinx.Graphics/Shader/Decoders/Decoder.cs b/Ryujinx.Graphics/Shader/Decoders/Decoder.cs index 86df3b20..754e0388 100644 --- a/Ryujinx.Graphics/Shader/Decoders/Decoder.cs +++ b/Ryujinx.Graphics/Shader/Decoders/Decoder.cs @@ -51,7 +51,7 @@ namespace Ryujinx.Graphics.Shader.Decoders while (workQueue.TryDequeue(out Block currBlock)) { - //Check if the current block is inside another block. + // Check if the current block is inside another block. if (BinarySearch(blocks, currBlock.Address, out int nBlkIndex)) { Block nBlock = blocks[nBlkIndex]; @@ -68,7 +68,7 @@ namespace Ryujinx.Graphics.Shader.Decoders continue; } - //If we have a block after the current one, set the limit address. + // If we have a block after the current one, set the limit address. ulong limitAddress = ulong.MaxValue; if (nBlkIndex != blocks.Count) @@ -96,10 +96,10 @@ namespace Ryujinx.Graphics.Shader.Decoders GetBlock(ssyOp.GetAbsoluteAddress()); } - //Set child blocks. "Branch" is the block the branch instruction - //points to (when taken), "Next" is the block at the next address, - //executed when the branch is not taken. For Unconditional Branches - //or end of program, Next is null. + // Set child blocks. "Branch" is the block the branch instruction + // points to (when taken), "Next" is the block at the next address, + // executed when the branch is not taken. For Unconditional Branches + // or end of program, Next is null. OpCode lastOp = currBlock.GetLastOp(); if (lastOp is OpCodeBranch op) @@ -113,7 +113,7 @@ namespace Ryujinx.Graphics.Shader.Decoders } } - //Insert the new block on the list (sorted by address). + // Insert the new block on the list (sorted by address). if (blocks.Count != 0) { Block nBlock = blocks[nBlkIndex]; @@ -187,7 +187,7 @@ namespace Ryujinx.Graphics.Shader.Decoders break; } - //Ignore scheduling instructions, which are written every 32 bytes. + // Ignore scheduling instructions, which are written every 32 bytes. if (((address - startAddress) & 0x1f) == 0) { address += 8; @@ -208,7 +208,7 @@ namespace Ryujinx.Graphics.Shader.Decoders if (emitter == null) { - //TODO: Warning, illegal encoding. + // TODO: Warning, illegal encoding. continue; } diff --git a/Ryujinx.Graphics/Shader/Decoders/OpCode.cs b/Ryujinx.Graphics/Shader/Decoders/OpCode.cs index b0f2ffdc..94af49e0 100644 --- a/Ryujinx.Graphics/Shader/Decoders/OpCode.cs +++ b/Ryujinx.Graphics/Shader/Decoders/OpCode.cs @@ -13,7 +13,7 @@ namespace Ryujinx.Graphics.Shader.Decoders public bool InvertPredicate { get; protected set; } - //When inverted, the always true predicate == always false. + // When inverted, the always true predicate == always false. public bool NeverExecute => Predicate.Index == RegisterConsts.PredicateTrueIndex && InvertPredicate; public OpCode(InstEmitter emitter, ulong address, long opCode) diff --git a/Ryujinx.Graphics/Shader/Decoders/OpCodeTextureScalar.cs b/Ryujinx.Graphics/Shader/Decoders/OpCodeTextureScalar.cs index 4389f453..470b81f5 100644 --- a/Ryujinx.Graphics/Shader/Decoders/OpCodeTextureScalar.cs +++ b/Ryujinx.Graphics/Shader/Decoders/OpCodeTextureScalar.cs @@ -1,3 +1,4 @@ +// ReSharper disable InconsistentNaming using Ryujinx.Graphics.Shader.Instructions; namespace Ryujinx.Graphics.Shader.Decoders diff --git a/Ryujinx.Graphics/Shader/Instructions/InstEmitAlu.cs b/Ryujinx.Graphics/Shader/Instructions/InstEmitAlu.cs index f7815e23..8e2b39bf 100644 --- a/Ryujinx.Graphics/Shader/Instructions/InstEmitAlu.cs +++ b/Ryujinx.Graphics/Shader/Instructions/InstEmitAlu.cs @@ -36,7 +36,7 @@ namespace Ryujinx.Graphics.Shader.Instructions context.Copy(GetDest(context), res); - //TODO: CC, X, corner cases + // TODO: CC, X, corner cases } public static void Iadd(EmitterContext context) @@ -60,7 +60,7 @@ namespace Ryujinx.Graphics.Shader.Instructions if (op.Extended) { - //Add carry, or subtract borrow. + // Add carry, or subtract borrow. res = context.IAdd(res, isSubtraction ? context.BitwiseNot(GetCF(context)) : context.BitwiseAnd(GetCF(context), Const(1))); @@ -102,7 +102,7 @@ namespace Ryujinx.Graphics.Shader.Instructions } else { - //TODO: Warning. + // TODO: Warning. } return src; @@ -126,7 +126,7 @@ namespace Ryujinx.Graphics.Shader.Instructions } else { - //TODO: Warning. + // TODO: Warning. } } @@ -134,7 +134,7 @@ namespace Ryujinx.Graphics.Shader.Instructions context.Copy(GetDest(context), res); - //TODO: CC, X, corner cases + // TODO: CC, X, corner cases } public static void Imnmx(EmitterContext context) @@ -162,7 +162,7 @@ namespace Ryujinx.Graphics.Shader.Instructions SetZnFlags(context, dest, op.SetCondCode); - //TODO: X flags. + // TODO: X flags. } public static void Iscadd(EmitterContext context) @@ -193,7 +193,7 @@ namespace Ryujinx.Graphics.Shader.Instructions context.Copy(GetDest(context), res); - //TODO: CC, X + // TODO: CC, X } public static void Iset(EmitterContext context) @@ -225,7 +225,7 @@ namespace Ryujinx.Graphics.Shader.Instructions context.Copy(dest, res); } - //TODO: CC, X + // TODO: CC, X } public static void Isetp(EmitterContext context) @@ -330,10 +330,10 @@ namespace Ryujinx.Graphics.Shader.Instructions public static void Rro(EmitterContext context) { - //This is the range reduction operator, - //we translate it as a simple move, as it - //should be always followed by a matching - //MUFU instruction. + // This is the range reduction operator, + // we translate it as a simple move, as it + // should be always followed by a matching + // MUFU instruction. OpCodeAlu op = (OpCodeAlu)context.CurrOp; bool negateB = op.RawOpCode.Extract(45); @@ -363,13 +363,13 @@ namespace Ryujinx.Graphics.Shader.Instructions if (!isMasked) { - //Clamped shift value. + // Clamped shift value. Operand isLessThan32 = context.ICompareLessUnsigned(srcB, Const(32)); res = context.ConditionalSelect(isLessThan32, res, Const(0)); } - //TODO: X, CC + // TODO: X, CC context.Copy(GetDest(context), res); } @@ -401,7 +401,7 @@ namespace Ryujinx.Graphics.Shader.Instructions if (!isMasked) { - //Clamped shift value. + // Clamped shift value. Operand resShiftBy32; if (isSigned) @@ -418,7 +418,7 @@ namespace Ryujinx.Graphics.Shader.Instructions res = context.ConditionalSelect(isLessThan32, res, resShiftBy32); } - //TODO: X, CC + // TODO: X, CC context.Copy(GetDest(context), res); } @@ -454,7 +454,7 @@ namespace Ryujinx.Graphics.Shader.Instructions Operand srcB = GetSrcB(context); Operand srcC = GetSrcC(context); - //XMAD immediates are 16-bits unsigned integers. + // XMAD immediates are 16-bits unsigned integers. if (srcB.Type == OperandType.Constant) { srcB = Const(srcB.Value & 0xffff); @@ -541,12 +541,12 @@ namespace Ryujinx.Graphics.Shader.Instructions if (extended) { - //Add with carry. + // Add with carry. res = context.IAdd(res, context.BitwiseAnd(GetCF(context), Const(1))); } else { - //Add (no carry in). + // Add (no carry in). res = context.IAdd(res, srcC); } @@ -654,12 +654,12 @@ namespace Ryujinx.Graphics.Shader.Instructions if (!extended || isSubtraction) { - //C = d < a + // C = d < a context.Copy(GetCF(context), context.ICompareLessUnsigned(res, srcA)); } else { - //C = (d == a && CIn) || d < a + // C = (d == a && CIn) || d < a Operand tempC0 = context.ICompareEqual (res, srcA); Operand tempC1 = context.ICompareLessUnsigned(res, srcA); @@ -668,7 +668,7 @@ namespace Ryujinx.Graphics.Shader.Instructions context.Copy(GetCF(context), context.BitwiseOr(tempC0, tempC1)); } - //V = (d ^ a) & ~(a ^ b) < 0 + // V = (d ^ a) & ~(a ^ b) < 0 Operand tempV0 = context.BitwiseExclusiveOr(res, srcA); Operand tempV1 = context.BitwiseExclusiveOr(srcA, srcB); diff --git a/Ryujinx.Graphics/Shader/Instructions/InstEmitAluHelper.cs b/Ryujinx.Graphics/Shader/Instructions/InstEmitAluHelper.cs index b5bde1a1..5c4f5398 100644 --- a/Ryujinx.Graphics/Shader/Instructions/InstEmitAluHelper.cs +++ b/Ryujinx.Graphics/Shader/Instructions/InstEmitAluHelper.cs @@ -65,12 +65,12 @@ namespace Ryujinx.Graphics.Shader.Instructions if (extended) { - //When the operation is extended, it means we are doing - //the operation on a long word with any number of bits, - //so we need to AND the zero flag from result with the - //previous result when extended is specified, to ensure - //we have ZF set only if all words are zero, and not just - //the last one. + // When the operation is extended, it means we are doing + // the operation on a long word with any number of bits, + // so we need to AND the zero flag from result with the + // previous result when extended is specified, to ensure + // we have ZF set only if all words are zero, and not just + // the last one. Operand oldZF = GetZF(context); Operand res = context.BitwiseAnd(context.ICompareEqual(dest, Const(0)), oldZF); diff --git a/Ryujinx.Graphics/Shader/Instructions/InstEmitConversion.cs b/Ryujinx.Graphics/Shader/Instructions/InstEmitConversion.cs index f5e9af03..c4de1750 100644 --- a/Ryujinx.Graphics/Shader/Instructions/InstEmitConversion.cs +++ b/Ryujinx.Graphics/Shader/Instructions/InstEmitConversion.cs @@ -47,7 +47,7 @@ namespace Ryujinx.Graphics.Shader.Instructions WriteFP(context, dstType, srcB); - //TODO: CC. + // TODO: CC. } public static void F2I(EmitterContext context) @@ -88,7 +88,7 @@ namespace Ryujinx.Graphics.Shader.Instructions srcB = context.FPConvertToS32(srcB); - //TODO: S/U64, conversion overflow handling. + // TODO: S/U64, conversion overflow handling. if (intType != IntegerType.S32) { int min = GetIntMin(intType); @@ -103,7 +103,7 @@ namespace Ryujinx.Graphics.Shader.Instructions context.Copy(dest, srcB); - //TODO: CC. + // TODO: CC. } public static void I2F(EmitterContext context) @@ -137,7 +137,7 @@ namespace Ryujinx.Graphics.Shader.Instructions WriteFP(context, dstType, srcB); - //TODO: CC. + // TODO: CC. } public static void I2I(EmitterContext context) @@ -149,7 +149,7 @@ namespace Ryujinx.Graphics.Shader.Instructions if (srcType == IntegerType.U64 || dstType == IntegerType.U64) { - //TODO: Warning. This instruction doesn't support 64-bits integers + // TODO: Warning. This instruction doesn't support 64-bits integers } bool srcIsSmallInt = srcType <= IntegerType.U16; @@ -189,7 +189,7 @@ namespace Ryujinx.Graphics.Shader.Instructions context.Copy(GetDest(context), srcB); - //TODO: CC. + // TODO: CC. } private static void WriteFP(EmitterContext context, FPType type, Operand srcB) @@ -206,7 +206,7 @@ namespace Ryujinx.Graphics.Shader.Instructions } else { - //TODO. + // TODO. } } } diff --git a/Ryujinx.Graphics/Shader/Instructions/InstEmitFArith.cs b/Ryujinx.Graphics/Shader/Instructions/InstEmitFArith.cs index 72492470..8c64c097 100644 --- a/Ryujinx.Graphics/Shader/Instructions/InstEmitFArith.cs +++ b/Ryujinx.Graphics/Shader/Instructions/InstEmitFArith.cs @@ -146,7 +146,7 @@ namespace Ryujinx.Graphics.Shader.Instructions context.Copy(dest, res); } - //TODO: CC, X + // TODO: CC, X } public static void Fsetp(EmitterContext context) diff --git a/Ryujinx.Graphics/Shader/Instructions/InstEmitFlow.cs b/Ryujinx.Graphics/Shader/Instructions/InstEmitFlow.cs index c4523f75..fb76e06a 100644 --- a/Ryujinx.Graphics/Shader/Instructions/InstEmitFlow.cs +++ b/Ryujinx.Graphics/Shader/Instructions/InstEmitFlow.cs @@ -19,8 +19,8 @@ namespace Ryujinx.Graphics.Shader.Instructions { OpCodeExit op = (OpCodeExit)context.CurrOp; - //TODO: Figure out how this is supposed to work in the - //presence of other condition codes. + // TODO: Figure out how this is supposed to work in the + // presence of other condition codes. if (op.Condition == Condition.Always) { context.Return(); @@ -54,8 +54,8 @@ namespace Ryujinx.Graphics.Shader.Instructions if (op.Targets.Count == 1) { - //If we have only one target, then the SSY is basically - //a branch, we can produce better codegen for this case. + // If we have only one target, then the SSY is basically + // a branch, we can produce better codegen for this case. OpCodeSsy opSsy = op.Targets.Keys.First(); EmitBranch(context, opSsy.GetAbsoluteAddress()); @@ -79,8 +79,8 @@ namespace Ryujinx.Graphics.Shader.Instructions private static void EmitBranch(EmitterContext context, ulong address) { - //If we're branching to the next instruction, then the branch - //is useless and we can ignore it. + // If we're branching to the next instruction, then the branch + // is useless and we can ignore it. if (address == context.CurrOp.Address + 8) { return; diff --git a/Ryujinx.Graphics/Shader/Instructions/InstEmitHelper.cs b/Ryujinx.Graphics/Shader/Instructions/InstEmitHelper.cs index e31528d0..c87e1789 100644 --- a/Ryujinx.Graphics/Shader/Instructions/InstEmitHelper.cs +++ b/Ryujinx.Graphics/Shader/Instructions/InstEmitHelper.cs @@ -53,7 +53,7 @@ namespace Ryujinx.Graphics.Shader.Instructions } else if (floatType == FPType.FP64) { - //TODO. + // TODO. } throw new ArgumentException($"Invalid floating point type \"{floatType}\"."); diff --git a/Ryujinx.Graphics/Shader/Instructions/InstEmitMemory.cs b/Ryujinx.Graphics/Shader/Instructions/InstEmitMemory.cs index d81e97a1..a2a50fce 100644 --- a/Ryujinx.Graphics/Shader/Instructions/InstEmitMemory.cs +++ b/Ryujinx.Graphics/Shader/Instructions/InstEmitMemory.cs @@ -71,7 +71,7 @@ namespace Ryujinx.Graphics.Shader.Instructions if (op.Size > IntegerSize.B64) { - //TODO: Warning. + // TODO: Warning. } bool isSmallInt = op.Size < IntegerSize.B32; @@ -121,7 +121,7 @@ namespace Ryujinx.Graphics.Shader.Instructions if (!(emit || cut)) { - //TODO: Warning. + // TODO: Warning. } if (emit) diff --git a/Ryujinx.Graphics/Shader/Instructions/InstEmitTexture.cs b/Ryujinx.Graphics/Shader/Instructions/InstEmitTexture.cs index 1b19d901..a9b29f40 100644 --- a/Ryujinx.Graphics/Shader/Instructions/InstEmitTexture.cs +++ b/Ryujinx.Graphics/Shader/Instructions/InstEmitTexture.cs @@ -443,7 +443,7 @@ namespace Ryujinx.Graphics.Shader.Instructions TextureProperty property = (TextureProperty)op.RawOpCode.Extract(22, 6); - //TODO: Validate and use property. + // TODO: Validate and use property. Instruction inst = Instruction.TextureSize; TextureType type = TextureType.Texture2D; diff --git a/Ryujinx.Graphics/Shader/Instructions/Lop3Expression.cs b/Ryujinx.Graphics/Shader/Instructions/Lop3Expression.cs index e55ed660..67e24957 100644 --- a/Ryujinx.Graphics/Shader/Instructions/Lop3Expression.cs +++ b/Ryujinx.Graphics/Shader/Instructions/Lop3Expression.cs @@ -16,11 +16,11 @@ namespace Ryujinx.Graphics.Shader.Instructions { Operand expr = null; - //Handle some simple cases, or cases where - //the KMap would yield poor results (like XORs). + // Handle some simple cases, or cases where + // the KMap would yield poor results (like XORs). if (imm == 0x96 || imm == 0x69) { - //XOR (0x96) and XNOR (0x69). + // XOR (0x96) and XNOR (0x69). if (imm == 0x69) { srcA = context.BitwiseNot(srcA); @@ -33,18 +33,18 @@ namespace Ryujinx.Graphics.Shader.Instructions } else if (imm == 0) { - //Always false. + // Always false. return Const(IrConsts.False); } else if (imm == 0xff) { - //Always true. + // Always true. return Const(IrConsts.True); } int map; - //Encode into gray code. + // Encode into gray code. map = ((imm >> 0) & 1) << 0; map |= ((imm >> 1) & 1) << 4; map |= ((imm >> 2) & 1) << 1; @@ -54,7 +54,7 @@ namespace Ryujinx.Graphics.Shader.Instructions map |= ((imm >> 6) & 1) << 2; map |= ((imm >> 7) & 1) << 6; - //Solve KMap, get sum of products. + // Solve KMap, get sum of products. int visited = 0; for (int index = 0; index < 8 && visited != 0xff; index++) @@ -76,7 +76,7 @@ namespace Ryujinx.Graphics.Shader.Instructions } } - //The mask should wrap, if we are on the high row, shift to low etc. + // The mask should wrap, if we are on the high row, shift to low etc. int mask2 = (index & 4) != 0 ? mask >> 4 : mask << 4; if ((map & mask2) == mask2) diff --git a/Ryujinx.Graphics/Shader/IntermediateRepresentation/Operation.cs b/Ryujinx.Graphics/Shader/IntermediateRepresentation/Operation.cs index f6579953..c60f393e 100644 --- a/Ryujinx.Graphics/Shader/IntermediateRepresentation/Operation.cs +++ b/Ryujinx.Graphics/Shader/IntermediateRepresentation/Operation.cs @@ -23,7 +23,7 @@ namespace Ryujinx.Graphics.Shader.IntermediateRepresentation Inst = inst; Dest = dest; - //The array may be modified externally, so we store a copy. + // The array may be modified externally, so we store a copy. _sources = (Operand[])sources.Clone(); for (int index = 0; index < _sources.Length; index++) diff --git a/Ryujinx.Graphics/Shader/ShaderHeader.cs b/Ryujinx.Graphics/Shader/ShaderHeader.cs index 53abdc56..379f3f35 100644 --- a/Ryujinx.Graphics/Shader/ShaderHeader.cs +++ b/Ryujinx.Graphics/Shader/ShaderHeader.cs @@ -158,7 +158,7 @@ namespace Ryujinx.Graphics.Shader } } - //Depth register is always two registers after the last color output. + // Depth register is always two registers after the last color output. return count + 1; } } diff --git a/Ryujinx.Graphics/Shader/StructuredIr/AstBlockVisitor.cs b/Ryujinx.Graphics/Shader/StructuredIr/AstBlockVisitor.cs index 9397fdb9..10d5dce0 100644 --- a/Ryujinx.Graphics/Shader/StructuredIr/AstBlockVisitor.cs +++ b/Ryujinx.Graphics/Shader/StructuredIr/AstBlockVisitor.cs @@ -33,7 +33,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr while (node != null) { - //We reached a child block, visit the nodes inside. + // We reached a child block, visit the nodes inside. while (node is AstBlock childBlock) { Block = childBlock; @@ -43,7 +43,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr BlockEntered?.Invoke(this, new BlockVisitationEventArgs(Block)); } - //Node may be null, if the block is empty. + // Node may be null, if the block is empty. if (node != null) { IAstNode next = Next(node); @@ -53,7 +53,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr node = next; } - //We reached the end of the list, go up on tree to the parent blocks. + // We reached the end of the list, go up on tree to the parent blocks. while (node == null && Block.Type != AstBlockType.Main) { BlockLeft?.Invoke(this, new BlockVisitationEventArgs(Block)); diff --git a/Ryujinx.Graphics/Shader/StructuredIr/GotoElimination.cs b/Ryujinx.Graphics/Shader/StructuredIr/GotoElimination.cs index dffc3142..8bcf9d9c 100644 --- a/Ryujinx.Graphics/Shader/StructuredIr/GotoElimination.cs +++ b/Ryujinx.Graphics/Shader/StructuredIr/GotoElimination.cs @@ -8,8 +8,8 @@ namespace Ryujinx.Graphics.Shader.StructuredIr { static class GotoElimination { - //This is a modified version of the algorithm presented on the paper - //"Taming Control Flow: A Structured Approach to Eliminating Goto Statements". + // This is a modified version of the algorithm presented on the paper + // "Taming Control Flow: A Structured Approach to Eliminating Goto Statements". public static void Eliminate(GotoStatement[] gotos) { for (int index = gotos.Length - 1; index >= 0; index--) @@ -43,10 +43,10 @@ namespace Ryujinx.Graphics.Shader.StructuredIr if (Previous(stmt.Goto) is AstBlock elseBlock && elseBlock.Type == AstBlockType.Else) { - //It's possible that the label was enclosed inside an else block, - //in this case we need to update the block and level. - //We also need to set the IsLoop for the case when the label is - //now before the goto, due to the newly introduced else block. + // It's possible that the label was enclosed inside an else block, + // in this case we need to update the block and level. + // We also need to set the IsLoop for the case when the label is + // now before the goto, due to the newly introduced else block. lBlock = ParentBlock(stmt.Label); lLevel = Level(lBlock); @@ -97,7 +97,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr private static bool DirectlyRelated(AstBlock lBlock, AstBlock rBlock, int lLevel, int rLevel) { - //If the levels are equal, they can be either siblings or indirectly related. + // If the levels are equal, they can be either siblings or indirectly related. if (lLevel == rLevel) { return false; @@ -171,9 +171,9 @@ namespace Ryujinx.Graphics.Shader.StructuredIr AstBlock block = origin; - //Check if a loop is enclosing the goto, and the block that is - //directly related to the label is above the loop block. - //In that case, we need to introduce a break to get out of the loop. + // Check if a loop is enclosing the goto, and the block that is + // directly related to the label is above the loop block. + // In that case, we need to introduce a break to get out of the loop. AstBlock loopBlock = origin; int loopLevel = gLevel; @@ -199,7 +199,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr } } - //Insert ifs to skip the parts that shouldn't be executed due to the goto. + // Insert ifs to skip the parts that shouldn't be executed due to the goto. bool tryInsertElse = stmt.IsUnconditional && origin.Type == AstBlockType.If; while (gLevel > lLevel) @@ -210,10 +210,10 @@ namespace Ryujinx.Graphics.Shader.StructuredIr AstBlock child = block; - //We can't move the goto in the middle of a if and a else block, in - //this case we need to move it after the else. - //IsLoop may need to be updated if the label is inside the else, as - //introducing a loop is the only way to ensure the else will be executed. + // We can't move the goto in the middle of a if and a else block, in + // this case we need to move it after the else. + // IsLoop may need to be updated if the label is inside the else, as + // introducing a loop is the only way to ensure the else will be executed. if (Next(child) is AstBlock elseBlock && elseBlock.Type == AstBlockType.Else) { child = elseBlock; @@ -256,7 +256,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr if (child.Type == AstBlockType.If) { - //Modify the if condition to allow it to be entered by the goto. + // Modify the if condition to allow it to be entered by the goto. if (!ContainsCondComb(child.Condition, Instruction.LogicalOr, stmt.Condition)) { child.OrCondition(stmt.Condition); @@ -264,7 +264,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr } else if (child.Type == AstBlockType.Else) { - //Modify the matching if condition to force the else to be entered by the goto. + // Modify the matching if condition to force the else to be entered by the goto. if (!(Previous(child) is AstBlock ifBlock) || ifBlock.Type != AstBlockType.If) { throw new InvalidOperationException("Found an else without a matching if."); @@ -309,14 +309,14 @@ namespace Ryujinx.Graphics.Shader.StructuredIr { if (block.Type == AstBlockType.DoWhile && first == block.First) { - //We only need to insert the continue if we're not at the end of the loop, - //or if our condition is different from the loop condition. + // We only need to insert the continue if we're not at the end of the loop, + // or if our condition is different from the loop condition. if (Next(stmt.Goto) != null || block.Condition != stmt.Condition) { EncloseSingleInst(stmt, Instruction.LoopContinue); } - //Modify the do-while condition to allow it to continue. + // Modify the do-while condition to allow it to continue. if (!ContainsCondComb(block.Condition, Instruction.LogicalOr, stmt.Condition)) { block.OrCondition(stmt.Condition); @@ -356,10 +356,10 @@ namespace Ryujinx.Graphics.Shader.StructuredIr cond = InverseCond(cond); } - //Do a quick check, if we are enclosing a single block, - //and the block type/condition matches the one we're going - //to create, then we don't need a new block, we can just - //return the old one. + // Do a quick check, if we are enclosing a single block, + // and the block type/condition matches the one we're going + // to create, then we don't need a new block, we can just + // return the old one. bool hasSingleNode = Next(first) == last; if (hasSingleNode && BlockMatches(first, type, cond)) diff --git a/Ryujinx.Graphics/Shader/StructuredIr/StructuredProgram.cs b/Ryujinx.Graphics/Shader/StructuredIr/StructuredProgram.cs index f65631be..26faaf36 100644 --- a/Ryujinx.Graphics/Shader/StructuredIr/StructuredProgram.cs +++ b/Ryujinx.Graphics/Shader/StructuredIr/StructuredProgram.cs @@ -69,10 +69,10 @@ namespace Ryujinx.Graphics.Shader.StructuredIr AstAssignment assignment; - //If all the sources are bool, it's better to use short-circuiting - //logical operations, rather than forcing a cast to int and doing - //a bitwise operation with the value, as it is likely to be used as - //a bool in the end. + // If all the sources are bool, it's better to use short-circuiting + // logical operations, rather than forcing a cast to int and doing + // a bitwise operation with the value, as it is likely to be used as + // a bool in the end. if (IsBitwiseInst(inst) && AreAllSourceTypesEqual(sources, VariableType.Bool)) { inst = GetLogicalFromBitwiseInst(inst); diff --git a/Ryujinx.Graphics/Shader/StructuredIr/StructuredProgramContext.cs b/Ryujinx.Graphics/Shader/StructuredIr/StructuredProgramContext.cs index e1f0503a..5d6ff890 100644 --- a/Ryujinx.Graphics/Shader/StructuredIr/StructuredProgramContext.cs +++ b/Ryujinx.Graphics/Shader/StructuredIr/StructuredProgramContext.cs @@ -65,8 +65,8 @@ namespace Ryujinx.Graphics.Shader.StructuredIr private void LookForDoWhileStatements(BasicBlock block) { - //Check if we have any predecessor whose index is greater than the - //current block, this indicates a loop. + // Check if we have any predecessor whose index is greater than the + // current block, this indicates a loop. bool done = false; foreach (BasicBlock predecessor in block.Predecessors.OrderByDescending(x => x.Index)) @@ -146,9 +146,9 @@ namespace Ryujinx.Graphics.Shader.StructuredIr { AddNode(gotoTempAsg); - //For block 0, we don't need to add the extra "reset" at the beggining, - //because it is already the first node to be executed on the shader, - //so it is reset to false by the "local" assignment anyway. + // For block 0, we don't need to add the extra "reset" at the beginning, + // because it is already the first node to be executed on the shader, + // so it is reset to false by the "local" assignment anyway. if (block.Index != 0) { Info.MainBlock.AddFirst(Assign(gotoTempAsg.Destination, Const(IrConsts.False))); diff --git a/Ryujinx.Graphics/Shader/Translation/AttributeConsts.cs b/Ryujinx.Graphics/Shader/Translation/AttributeConsts.cs index 0fd16ce8..f21a6252 100644 --- a/Ryujinx.Graphics/Shader/Translation/AttributeConsts.cs +++ b/Ryujinx.Graphics/Shader/Translation/AttributeConsts.cs @@ -29,8 +29,8 @@ namespace Ryujinx.Graphics.Shader.IntermediateRepresentation public const int UserAttributeEnd = UserAttributeBase + UserAttributesCount * 16; - //Note: Those attributes are used internally by the translator - //only, they don't exist on Maxwell. + // Note: Those attributes are used internally by the translator + // only, they don't exist on Maxwell. public const int FragmentOutputDepth = 0x1000000; public const int FragmentOutputColorBase = 0x1000010; public const int FragmentOutputColorEnd = FragmentOutputColorBase + 8 * 16; diff --git a/Ryujinx.Graphics/Shader/Translation/Dominance.cs b/Ryujinx.Graphics/Shader/Translation/Dominance.cs index b4b80e3e..6a3ff35f 100644 --- a/Ryujinx.Graphics/Shader/Translation/Dominance.cs +++ b/Ryujinx.Graphics/Shader/Translation/Dominance.cs @@ -5,8 +5,8 @@ namespace Ryujinx.Graphics.Shader.Translation { static class Dominance { - //Those methods are an implementation of the algorithms on "A Simple, Fast Dominance Algorithm". - //https://www.cs.rice.edu/~keith/EMBED/dom.pdf + // Those methods are an implementation of the algorithms on "A Simple, Fast Dominance Algorithm". + // https://www.cs.rice.edu/~keith/EMBED/dom.pdf public static void FindDominators(BasicBlock entry, int blocksCount) { HashSet visited = new HashSet(); diff --git a/Ryujinx.Graphics/Shader/Translation/Optimizations/BranchElimination.cs b/Ryujinx.Graphics/Shader/Translation/Optimizations/BranchElimination.cs index 2b0f1905..070f07a4 100644 --- a/Ryujinx.Graphics/Shader/Translation/Optimizations/BranchElimination.cs +++ b/Ryujinx.Graphics/Shader/Translation/Optimizations/BranchElimination.cs @@ -19,13 +19,13 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations private static bool IsRedundantBranch(Operation current, BasicBlock nextBlock) { - //Here we check that: - //- The current block ends with a branch. - //- The next block only contains a branch. - //- The branch on the next block is unconditional. - //- Both branches are jumping to the same location. - //In this case, the branch on the current block can be removed, - //as the next block is going to jump to the same place anyway. + // Here we check that: + // - The current block ends with a branch. + // - The next block only contains a branch. + // - The branch on the next block is unconditional. + // - Both branches are jumping to the same location. + // In this case, the branch on the current block can be removed, + // as the next block is going to jump to the same place anyway. if (nextBlock == null) { return false; diff --git a/Ryujinx.Graphics/Shader/Translation/Optimizations/HalfConversion.cs b/Ryujinx.Graphics/Shader/Translation/Optimizations/HalfConversion.cs index 9ef35abc..96060272 100644 --- a/Ryujinx.Graphics/Shader/Translation/Optimizations/HalfConversion.cs +++ b/Ryujinx.Graphics/Shader/Translation/Optimizations/HalfConversion.cs @@ -12,7 +12,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations if (exponent == 0x1f) { - //NaN or Infinity. + // NaN or Infinity. mantissa <<= 13; exponent = 0xff; } @@ -20,7 +20,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations { if (exponent == 0) { - //Denormal. + // Denormal. int e = -1; int m = mantissa; diff --git a/Ryujinx.Graphics/Shader/Translation/Optimizations/Optimizer.cs b/Ryujinx.Graphics/Shader/Translation/Optimizations/Optimizer.cs index 88118e3a..8cce0e74 100644 --- a/Ryujinx.Graphics/Shader/Translation/Optimizations/Optimizer.cs +++ b/Ryujinx.Graphics/Shader/Translation/Optimizations/Optimizer.cs @@ -81,8 +81,8 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations private static void PropagateCopy(Operation copyOp) { - //Propagate copy source operand to all uses of - //the destination operand. + // Propagate copy source operand to all uses of + // the destination operand. Operand dest = copyOp.Dest; Operand src = copyOp.GetSource(0); @@ -102,8 +102,8 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations private static bool PropagatePack(Operation packOp) { - //Propagate pack source operands to uses by unpack - //instruction. The source depends on the unpack instruction. + // Propagate pack source operands to uses by unpack + // instruction. The source depends on the unpack instruction. bool modified = false; Operand dest = packOp.Dest; @@ -132,8 +132,8 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations private static void RemoveNode(BasicBlock block, LinkedListNode llNode) { - //Remove a node from the nodes list, and also remove itself - //from all the use lists on the operands that this node uses. + // Remove a node from the nodes list, and also remove itself + // from all the use lists on the operands that this node uses. block.Operations.Remove(llNode); Queue nodes = new Queue(); diff --git a/Ryujinx.Graphics/Shader/Translation/Optimizations/Simplification.cs b/Ryujinx.Graphics/Shader/Translation/Optimizations/Simplification.cs index 56b1543f..d6366dfe 100644 --- a/Ryujinx.Graphics/Shader/Translation/Optimizations/Simplification.cs +++ b/Ryujinx.Graphics/Shader/Translation/Optimizations/Simplification.cs @@ -14,7 +14,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations { case Instruction.Add: case Instruction.BitwiseExclusiveOr: - TryEliminateBinaryOpComutative(operation, 0); + TryEliminateBinaryOpCommutative(operation, 0); break; case Instruction.BitwiseAnd: @@ -34,7 +34,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations break; case Instruction.Multiply: - TryEliminateBinaryOpComutative(operation, 1); + TryEliminateBinaryOpCommutative(operation, 1); break; case Instruction.ShiftLeft: @@ -48,9 +48,9 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations private static void TryEliminateBitwiseAnd(Operation operation) { - //Try to recognize and optimize those 3 patterns (in order): - //x & 0xFFFFFFFF == x, 0xFFFFFFFF & y == y, - //x & 0x00000000 == 0x00000000, 0x00000000 & y == 0x00000000 + // Try to recognize and optimize those 3 patterns (in order): + // x & 0xFFFFFFFF == x, 0xFFFFFFFF & y == y, + // x & 0x00000000 == 0x00000000, 0x00000000 & y == 0x00000000 Operand x = operation.GetSource(0); Operand y = operation.GetSource(1); @@ -70,9 +70,9 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations private static void TryEliminateBitwiseOr(Operation operation) { - //Try to recognize and optimize those 3 patterns (in order): - //x | 0x00000000 == x, 0x00000000 | y == y, - //x | 0xFFFFFFFF == 0xFFFFFFFF, 0xFFFFFFFF | y == 0xFFFFFFFF + // Try to recognize and optimize those 3 patterns (in order): + // x | 0x00000000 == x, 0x00000000 | y == y, + // x | 0xFFFFFFFF == 0xFFFFFFFF, 0xFFFFFFFF | y == 0xFFFFFFFF Operand x = operation.GetSource(0); Operand y = operation.GetSource(1); @@ -101,7 +101,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations } } - private static void TryEliminateBinaryOpComutative(Operation operation, int comparand) + private static void TryEliminateBinaryOpCommutative(Operation operation, int comparand) { Operand x = operation.GetSource(0); Operand y = operation.GetSource(1); @@ -125,8 +125,8 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations return; } - //The condition is constant, we can turn it into a copy, and select - //the source based on the condition value. + // The condition is constant, we can turn it into a copy, and select + // the source based on the condition value. int srcIndex = cond.Value != 0 ? 1 : 2; Operand source = operation.GetSource(srcIndex); diff --git a/Ryujinx.Graphics/Shader/Translation/Ssa.cs b/Ryujinx.Graphics/Shader/Translation/Ssa.cs index b612649c..a4d763be 100644 --- a/Ryujinx.Graphics/Shader/Translation/Ssa.cs +++ b/Ryujinx.Graphics/Shader/Translation/Ssa.cs @@ -86,7 +86,7 @@ namespace Ryujinx.Graphics.Shader.Translation Queue dfPhiBlocks = new Queue(); - //First pass, get all defs and locals uses. + // First pass, get all defs and locals uses. for (int blkIndex = 0; blkIndex < blocks.Length; blkIndex++) { Operand[] localDefs = new Operand[RegisterConsts.TotalCount]; @@ -157,7 +157,7 @@ namespace Ryujinx.Graphics.Shader.Translation } } - //Second pass, rename variables with definitions on different blocks. + // Second pass, rename variables with definitions on different blocks. for (int blkIndex = 0; blkIndex < blocks.Length; blkIndex++) { Operand[] localDefs = new Operand[RegisterConsts.TotalCount]; @@ -251,10 +251,10 @@ namespace Ryujinx.Graphics.Shader.Translation private static Operand InsertPhi(DefMap[] globalDefs, BasicBlock block, Register reg) { - //This block has a Phi that has not been materialized yet, but that - //would define a new version of the variable we're looking for. We need - //to materialize the Phi, add all the block/operand pairs into the Phi, and - //then use the definition from that Phi. + // This block has a Phi that has not been materialized yet, but that + // would define a new version of the variable we're looking for. We need + // to materialize the Phi, add all the block/operand pairs into the Phi, and + // then use the definition from that Phi. Operand local = Local(); PhiNode phi = new PhiNode(local); diff --git a/Ryujinx.Graphics/Shader/Translation/Translator.cs b/Ryujinx.Graphics/Shader/Translation/Translator.cs index 706f3cfa..fcebe913 100644 --- a/Ryujinx.Graphics/Shader/Translation/Translator.cs +++ b/Ryujinx.Graphics/Shader/Translation/Translator.cs @@ -28,7 +28,7 @@ namespace Ryujinx.Graphics.Shader.Translation if (addressB != 0) { - //Dual vertex shader. + // Dual vertex shader. Operation[] shaderOpsB = DecodeShader(memory, addressB, config.Type); shaderOps = Combine(shaderOps, shaderOpsB); @@ -86,10 +86,10 @@ namespace Ryujinx.Graphics.Shader.Translation if (op is OpCodeSync opSync) { - //If the instruction is a SYNC instruction with only one - //possible target address, then the instruction is basically - //just a simple branch, we can generate code similar to branch - //instructions, with the condition check on the branch itself. + // If the instruction is a SYNC instruction with only one + // possible target address, then the instruction is basically + // just a simple branch, we can generate code similar to branch + // instructions, with the condition check on the branch itself. skipPredicateCheck |= opSync.Targets.Count < 2; } @@ -136,15 +136,15 @@ namespace Ryujinx.Graphics.Shader.Translation private static Operation[] Combine(Operation[] a, Operation[] b) { - //Here we combine two shaders. - //For shader A: - //- All user attribute stores on shader A are turned into copies to a - //temporary variable. It's assumed that shader B will consume them. - //- All return instructions are turned into branch instructions, the - //branch target being the start of the shader B code. - //For shader B: - //- All user attribute loads on shader B are turned into copies from a - //temporary variable, as long that attribute is written by shader A. + // Here we combine two shaders. + // For shader A: + // - All user attribute stores on shader A are turned into copies to a + // temporary variable. It's assumed that shader B will consume them. + // - All return instructions are turned into branch instructions, the + // branch target being the start of the shader B code. + // For shader B: + // - All user attribute loads on shader B are turned into copies from a + // temporary variable, as long that attribute is written by shader A. List output = new List(a.Length + b.Length); Operand[] temps = new Operand[AttributeConsts.UserAttributesCount * 4]; diff --git a/Ryujinx.Graphics/VDec/H264Decoder.cs b/Ryujinx.Graphics/VDec/H264Decoder.cs index 01085a73..24c7e0b9 100644 --- a/Ryujinx.Graphics/VDec/H264Decoder.cs +++ b/Ryujinx.Graphics/VDec/H264Decoder.cs @@ -89,7 +89,7 @@ namespace Ryujinx.Graphics.VDec { H264BitStreamWriter writer = new H264BitStreamWriter(data); - //Sequence Parameter Set. + // Sequence Parameter Set. writer.WriteU(1, 24); writer.WriteU(0, 1); writer.WriteU(3, 2); @@ -145,7 +145,7 @@ namespace Ryujinx.Graphics.VDec writer.End(); - //Picture Parameter Set. + // Picture Parameter Set. writer.WriteU(1, 24); writer.WriteU(0, 1); writer.WriteU(3, 2); @@ -196,7 +196,7 @@ namespace Ryujinx.Graphics.VDec } } - //ZigZag LUTs from libavcodec. + // ZigZag LUTs from libavcodec. private static readonly byte[] ZigZagDirect = new byte[] { 0, 1, 8, 16, 9, 2, 3, 10, diff --git a/Ryujinx.Graphics/VDec/VideoDecoder.cs b/Ryujinx.Graphics/VDec/VideoDecoder.cs index 2be47a30..3ebb93f4 100644 --- a/Ryujinx.Graphics/VDec/VideoDecoder.cs +++ b/Ryujinx.Graphics/VDec/VideoDecoder.cs @@ -254,7 +254,7 @@ namespace Ryujinx.Graphics.VDec } } - //Copy chroma data from both channels with interleaving. + // Copy chroma data from both channels with interleaving. for (int y = 0; y < halfHeight; y++) { int src = y * halfSrcWidth; diff --git a/Ryujinx.Graphics/VDec/Vp9Decoder.cs b/Ryujinx.Graphics/VDec/Vp9Decoder.cs index d77bc6c4..b20a40be 100644 --- a/Ryujinx.Graphics/VDec/Vp9Decoder.cs +++ b/Ryujinx.Graphics/VDec/Vp9Decoder.cs @@ -287,7 +287,7 @@ namespace Ryujinx.Graphics.VDec bool showFrame = !isFrameIntra; - //Write compressed header. + // Write compressed header. byte[] compressedHeaderData; using (MemoryStream compressedHeader = new MemoryStream()) @@ -437,7 +437,7 @@ namespace Ryujinx.Graphics.VDec compressedHeaderData = compressedHeader.ToArray(); } - //Write uncompressed header. + // Write uncompressed header. using (MemoryStream encodedHeader = new MemoryStream()) { VpxBitStreamWriter writer = new VpxBitStreamWriter(encodedHeader); @@ -460,8 +460,8 @@ namespace Ryujinx.Graphics.VDec _cachedRefFrames.Clear(); - //On key frames, all frame slots are set to the current frame, - //so the value of the selected slot doesn't really matter. + // On key frames, all frame slots are set to the current frame, + // so the value of the selected slot doesn't really matter. GetNewFrameSlot(keys.CurrKey); } else @@ -593,8 +593,8 @@ namespace Ryujinx.Graphics.VDec int tileColsLog2IncMask = (1 << tileColsLog2Diff) - 1; - //If it's less than the maximum, we need to add an extra 0 on the bitstream - //to indicate that it should stop reading. + // If it's less than the maximum, we need to add an extra 0 on the bitstream + // to indicate that it should stop reading. if (header.TileColsLog2 < maxTileColsLog2) { writer.WriteU(tileColsLog2IncMask << 1, tileColsLog2Diff + 1); @@ -653,8 +653,8 @@ namespace Ryujinx.Graphics.VDec return node.Value; } - //Reference frame was lost. - //What we should do in this case? + // Reference frame was lost. + // What we should do in this case? return 0; } @@ -668,8 +668,8 @@ namespace Ryujinx.Graphics.VDec private void WriteCoefProbabilityUpdate(VpxRangeEncoder writer, int txMode, byte[] New, byte[] old) { - //Note: There's 1 byte added on each packet for alignment, - //this byte is ignored when doing updates. + // Note: There's 1 byte added on each packet for alignment, + // this byte is ignored when doing updates. const int blockBytes = 2 * 2 * 6 * 6 * 4; bool NeedsUpdate(int baseIndex) diff --git a/Ryujinx.HLE/Exceptions/ServiceNotImplementedException.cs b/Ryujinx.HLE/Exceptions/ServiceNotImplementedException.cs index 893ce26e..1a85ac0f 100644 --- a/Ryujinx.HLE/Exceptions/ServiceNotImplementedException.cs +++ b/Ryujinx.HLE/Exceptions/ServiceNotImplementedException.cs @@ -1,10 +1,8 @@ using Ryujinx.Common; using Ryujinx.HLE.HOS; using Ryujinx.HLE.HOS.Ipc; -using Ryujinx.HLE.HOS.Kernel.Ipc; using Ryujinx.HLE.HOS.Services; using System; -using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; diff --git a/Ryujinx.HLE/FileSystem/Content/ContentManager.cs b/Ryujinx.HLE/FileSystem/Content/ContentManager.cs index 67c3f263..3812e580 100644 --- a/Ryujinx.HLE/FileSystem/Content/ContentManager.cs +++ b/Ryujinx.HLE/FileSystem/Content/ContentManager.cs @@ -131,7 +131,7 @@ namespace Ryujinx.HLE.FileSystem.Content } } - if(_locationEntries.ContainsKey(storageId) && _locationEntries[storageId]?.Count == 0) + if (_locationEntries.ContainsKey(storageId) && _locationEntries[storageId]?.Count == 0) { _locationEntries.Remove(storageId); } diff --git a/Ryujinx.HLE/HOS/Diagnostics/Demangler/Demangler.cs b/Ryujinx.HLE/HOS/Diagnostics/Demangler/Demangler.cs index b654ba79..1e621121 100644 --- a/Ryujinx.HLE/HOS/Diagnostics/Demangler/Demangler.cs +++ b/Ryujinx.HLE/HOS/Diagnostics/Demangler/Demangler.cs @@ -546,7 +546,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler _position += 2; // FIXME: GNU c++flit returns this but that is not what is supposed to be returned. return new NameType("half"); - //return new NameType("decimal16"); + // return new NameType("decimal16"); case 'i': _position += 2; return new NameType("char32_t"); @@ -560,7 +560,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler _position += 2; // FIXME: GNU c++flit returns this but that is not what is supposed to be returned. return new NameType("decltype(nullptr)"); - //return new NameType("std::nullptr_t"); + // return new NameType("std::nullptr_t"); case 't': case 'T': _position += 2; @@ -1314,7 +1314,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler if (result != null) { // TODO: ABI Tags - //throw new Exception("ABI Tags not implemented"); + // throw new Exception("ABI Tags not implemented"); } return result; } @@ -2909,7 +2909,7 @@ namespace Ryujinx.HLE.HOS.Diagnostics.Demangler } } while (!ConsumeIf("E")); } - // ::= sr [tempate-args] # T::x / decltype(p)::x + // ::= sr [template-args] # T::x / decltype(p)::x else { result = ParseUnresolvedType(); diff --git a/Ryujinx.HLE/HOS/Homebrew.cs b/Ryujinx.HLE/HOS/Homebrew.cs index b0e05554..b11a4640 100644 --- a/Ryujinx.HLE/HOS/Homebrew.cs +++ b/Ryujinx.HLE/HOS/Homebrew.cs @@ -7,26 +7,26 @@ namespace Ryujinx.HLE.HOS { public const string TemporaryNroSuffix = ".ryu_tmp.nro"; - //http://switchbrew.org/index.php?title=Homebrew_ABI + // http://switchbrew.org/index.php?title=Homebrew_ABI public static void WriteHbAbiData(MemoryManager memory, long position, int mainThreadHandle, string switchPath) { - //MainThreadHandle. + // MainThreadHandle. WriteConfigEntry(memory, ref position, 1, 0, mainThreadHandle); - //NextLoadPath. + // NextLoadPath. WriteConfigEntry(memory, ref position, 2, 0, position + 0x200, position + 0x400); - //Argv. + // Argv. long argvPosition = position + 0xC00; memory.WriteBytes(argvPosition, Encoding.ASCII.GetBytes(switchPath + "\0")); WriteConfigEntry(memory, ref position, 5, 0, 0, argvPosition); - //AppletType. + // AppletType. WriteConfigEntry(memory, ref position, 7); - //EndOfList. + // EndOfList. WriteConfigEntry(memory, ref position, 0); } diff --git a/Ryujinx.HLE/HOS/HomebrewRomFsStream.cs b/Ryujinx.HLE/HOS/HomebrewRomFsStream.cs index f39faf4d..59bc881f 100644 --- a/Ryujinx.HLE/HOS/HomebrewRomFsStream.cs +++ b/Ryujinx.HLE/HOS/HomebrewRomFsStream.cs @@ -53,7 +53,7 @@ namespace Ryujinx.HLE.HOS offset += _positionOffset; } - return _baseStream.Seek(offset, origin); + return _baseStream.Seek(offset, origin); } public override void SetLength(long value) diff --git a/Ryujinx.HLE/HOS/Horizon.cs b/Ryujinx.HLE/HOS/Horizon.cs index 95cd30f0..496fbdbe 100644 --- a/Ryujinx.HLE/HOS/Horizon.cs +++ b/Ryujinx.HLE/HOS/Horizon.cs @@ -156,8 +156,8 @@ namespace Ryujinx.HLE.HOS AutoObjectNames = new ConcurrentDictionary(); - //Note: This is not really correct, but with HLE of services, the only memory - //region used that is used is Application, so we can use the other ones for anything. + // Note: This is not really correct, but with HLE of services, the only memory + // region used that is used is Application, so we can use the other ones for anything. KMemoryRegionManager region = MemoryRegions[(int)MemoryRegion.NvServices]; ulong hidPa = region.Address; @@ -660,7 +660,7 @@ namespace Ryujinx.HLE.HOS { if (disposing) { - //Force all threads to exit. + // Force all threads to exit. lock (Processes) { foreach (KProcess process in Processes.Values) @@ -669,8 +669,8 @@ namespace Ryujinx.HLE.HOS } } - //It's only safe to release resources once all threads - //have exited. + // It's only safe to release resources once all threads + // have exited. ThreadCounter.Signal(); ThreadCounter.Wait(); diff --git a/Ryujinx.HLE/HOS/Ipc/IpcHandler.cs b/Ryujinx.HLE/HOS/Ipc/IpcHandler.cs index 9f087a1a..e940d774 100644 --- a/Ryujinx.HLE/HOS/Ipc/IpcHandler.cs +++ b/Ryujinx.HLE/HOS/Ipc/IpcHandler.cs @@ -72,7 +72,7 @@ namespace Ryujinx.HLE.HOS.Ipc break; } - //TODO: Whats the difference between IpcDuplicateSession/Ex? + // TODO: Whats the difference between IpcDuplicateSession/Ex? case 2: case 4: { @@ -95,7 +95,7 @@ namespace Ryujinx.HLE.HOS.Ipc } else if (request.Type == IpcMessageType.CloseSession) { - //TODO + // TODO } else { diff --git a/Ryujinx.HLE/HOS/Ipc/IpcMessage.cs b/Ryujinx.HLE/HOS/Ipc/IpcMessage.cs index 85b6820a..012c3167 100644 --- a/Ryujinx.HLE/HOS/Ipc/IpcMessage.cs +++ b/Ryujinx.HLE/HOS/Ipc/IpcMessage.cs @@ -133,9 +133,9 @@ namespace Ryujinx.HLE.HOS.Ipc int pad0 = (int)GetPadSize16(cmdPtr + 8 + handleData.Length); - //Apparently, padding after Raw Data is 16 bytes, however when there is - //padding before Raw Data too, we need to subtract the size of this padding. - //This is the weirdest padding I've seen so far... + // Apparently, padding after Raw Data is 16 bytes, however when there is + // padding before Raw Data too, we need to subtract the size of this padding. + // This is the weirdest padding I've seen so far... int pad1 = 0x10 - pad0; dataLength = (dataLength + pad0 + pad1) / 4; diff --git a/Ryujinx.HLE/HOS/Kernel/Common/KernelInit.cs b/Ryujinx.HLE/HOS/Kernel/Common/KernelInit.cs index 2a2aa743..bbb75f18 100644 --- a/Ryujinx.HLE/HOS/Kernel/Common/KernelInit.cs +++ b/Ryujinx.HLE/HOS/Kernel/Common/KernelInit.cs @@ -114,9 +114,9 @@ namespace Ryujinx.HLE.HOS.Kernel.Common nvServicesRg = new KMemoryArrangeRegion(nvServicesRgEnd - nvServicesRgSize, nvServicesRgSize); appletRg = new KMemoryArrangeRegion(nvServicesRgEnd, appletRgSize); - //Note: There is an extra region used by the kernel, however - //since we are doing HLE we are not going to use that memory, so give all - //the remaining memory space to services. + // Note: There is an extra region used by the kernel, however + // since we are doing HLE we are not going to use that memory, so give all + // the remaining memory space to services. ulong serviceRgSize = nvServicesRg.Address - DramMemoryMap.SlabHeapEnd; serviceRg = new KMemoryArrangeRegion(DramMemoryMap.SlabHeapEnd, serviceRgSize); diff --git a/Ryujinx.HLE/HOS/Kernel/Common/MersenneTwister.cs b/Ryujinx.HLE/HOS/Kernel/Common/MersenneTwister.cs index 6b686901..7f767c1c 100644 --- a/Ryujinx.HLE/HOS/Kernel/Common/MersenneTwister.cs +++ b/Ryujinx.HLE/HOS/Kernel/Common/MersenneTwister.cs @@ -34,16 +34,16 @@ namespace Ryujinx.HLE.HOS.Kernel.Common if (range == -1) { - //Increment would cause a overflow, special case. + // Increment would cause a overflow, special case. return GenRandomNumber(2, 2, 32, 0xffffffffu, 0xffffffffu); } range++; - //This is log2(Range) plus one. + // This is log2(Range) plus one. int nextRangeLog2 = 64 - BitUtils.CountLeadingZeros64(range); - //If Range is already power of 2, subtract one to use log2(Range) directly. + // If Range is already power of 2, subtract one to use log2(Range) directly. int rangeLog2 = nextRangeLog2 - (BitUtils.IsPowerOfTwo64(range) ? 1 : 0); int parts = rangeLog2 > 32 ? 2 : 1; diff --git a/Ryujinx.HLE/HOS/Kernel/Ipc/KBufferDescriptorTable.cs b/Ryujinx.HLE/HOS/Kernel/Ipc/KBufferDescriptorTable.cs index ac805bee..6aa211dd 100644 --- a/Ryujinx.HLE/HOS/Kernel/Ipc/KBufferDescriptorTable.cs +++ b/Ryujinx.HLE/HOS/Kernel/Ipc/KBufferDescriptorTable.cs @@ -84,7 +84,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc ulong clientAddrTruncated = BitUtils.AlignDown(desc.ClientAddress, KMemoryManager.PageSize); ulong clientAddrRounded = BitUtils.AlignUp (desc.ClientAddress, KMemoryManager.PageSize); - //Check if address is not aligned, in this case we need to perform 2 copies. + // Check if address is not aligned, in this case we need to perform 2 copies. if (clientAddrTruncated != clientAddrRounded) { ulong copySize = clientAddrRounded - desc.ClientAddress; diff --git a/Ryujinx.HLE/HOS/Kernel/Ipc/KClientPort.cs b/Ryujinx.HLE/HOS/Kernel/Ipc/KClientPort.cs index eaa4322d..901b0222 100644 --- a/Ryujinx.HLE/HOS/Kernel/Ipc/KClientPort.cs +++ b/Ryujinx.HLE/HOS/Kernel/Ipc/KClientPort.cs @@ -16,8 +16,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc private object _countIncLock; - //TODO: Remove that, we need it for now to allow HLE - //SM implementation to work with the new IPC system. + // TODO: Remove that, we need it for now to allow HLE + // SM implementation to work with the new IPC system. public IpcService Service { get; set; } public KClientPort(Horizon system, KPort parent, int maxSessions) : base(system) diff --git a/Ryujinx.HLE/HOS/Kernel/Ipc/KClientSession.cs b/Ryujinx.HLE/HOS/Kernel/Ipc/KClientSession.cs index f139d3d4..a5109e96 100644 --- a/Ryujinx.HLE/HOS/Kernel/Ipc/KClientSession.cs +++ b/Ryujinx.HLE/HOS/Kernel/Ipc/KClientSession.cs @@ -13,8 +13,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc public ChannelState State { get; set; } - //TODO: Remove that, we need it for now to allow HLE - //services implementation to work with the new IPC system. + // TODO: Remove that, we need it for now to allow HLE + // services implementation to work with the new IPC system. public IpcService Service { get; set; } public KClientSession(Horizon system, KSession parent) : base(system) diff --git a/Ryujinx.HLE/HOS/Kernel/Ipc/KServerSession.cs b/Ryujinx.HLE/HOS/Kernel/Ipc/KServerSession.cs index 5a45ff4a..7fba645f 100644 --- a/Ryujinx.HLE/HOS/Kernel/Ipc/KServerSession.cs +++ b/Ryujinx.HLE/HOS/Kernel/Ipc/KServerSession.cs @@ -327,7 +327,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc uint offset; - //Copy handles. + // Copy handles. if (clientHeader.HasHandles) { if (clientHeader.MoveHandlesCount != 0) @@ -399,7 +399,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc offset = 2; } - //Copy pointer/receive list buffers. + // Copy pointer/receive list buffers. uint recvListDstOffset = 0; for (int index = 0; index < clientHeader.PointerBuffersCount; index++) @@ -455,7 +455,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc offset += 2; } - //Copy send, receive and exchange buffers. + // Copy send, receive and exchange buffers. uint totalBuffersCount = clientHeader.SendBuffersCount + clientHeader.ReceiveBuffersCount + @@ -551,7 +551,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc offset += 3; } - //Copy raw data. + // Copy raw data. if (clientHeader.RawDataSizeInWords != 0) { ulong copySrc = clientMsg.Address + offset * 4; @@ -683,13 +683,13 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc return KernelResult.InvalidCombination; } - //Read receive list. + // Read receive list. ulong[] receiveList = GetReceiveList( clientMsg, clientHeader.ReceiveListType, clientHeader.ReceiveListOffset); - //Copy receive and exchange buffers. + // Copy receive and exchange buffers. clientResult = request.BufferDescriptorTable.CopyBuffersToClient(clientProcess.MemoryManager); if (clientResult != KernelResult.Success) @@ -699,11 +699,11 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc return serverResult; } - //Copy header. + // Copy header. System.Device.Memory.WriteUInt32((long)clientMsg.DramAddress + 0, serverHeader.Word0); System.Device.Memory.WriteUInt32((long)clientMsg.DramAddress + 4, serverHeader.Word1); - //Copy handles. + // Copy handles. uint offset; if (serverHeader.HasHandles) @@ -763,7 +763,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc offset = 2; } - //Copy pointer/receive list buffers. + // Copy pointer/receive list buffers. uint recvListDstOffset = 0; for (int index = 0; index < serverHeader.PointerBuffersCount; index++) @@ -811,7 +811,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc offset += 2; } - //Set send, receive and exchange buffer descriptors to zero. + // Set send, receive and exchange buffer descriptors to zero. uint totalBuffersCount = serverHeader.SendBuffersCount + serverHeader.ReceiveBuffersCount + @@ -828,7 +828,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc offset += 3; } - //Copy raw data. + // Copy raw data. if (serverHeader.RawDataSizeInWords != 0) { ulong copyDst = clientMsg.Address + offset * 4; @@ -861,7 +861,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc } } - //Unmap buffers from server. + // Unmap buffers from server. clientResult = request.BufferDescriptorTable.UnmapServerBuffers(serverProcess.MemoryManager); if (clientResult != KernelResult.Success) @@ -1125,9 +1125,9 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc continue; } - //Client sessions can only be disconnected on async requests (because - //the client would be otherwise blocked waiting for the response), so - //we only need to handle the async case here. + // Client sessions can only be disconnected on async requests (because + // the client would be otherwise blocked waiting for the response), so + // we only need to handle the async case here. if (request.AsyncEvent != null) { SendResultToAsyncRequestClient(request, KernelResult.PortRemoteClosed); @@ -1204,7 +1204,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc private void WakeClientThread(KSessionRequest request, KernelResult result) { - //Wait client thread waiting for a response for the given request. + // Wait client thread waiting for a response for the given request. if (request.AsyncEvent != null) { SendResultToAsyncRequestClient(request, result); @@ -1237,7 +1237,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Ipc private void WakeServerThreads(KernelResult result) { - //Wake all server threads waiting for requests. + // Wake all server threads waiting for requests. System.CriticalSection.Enter(); foreach (KThread thread in WaitingThreads) diff --git a/Ryujinx.HLE/HOS/Kernel/Memory/KMemoryManager.cs b/Ryujinx.HLE/HOS/Kernel/Memory/KMemoryManager.cs index 7a40139c..448ae54c 100644 --- a/Ryujinx.HLE/HOS/Kernel/Memory/KMemoryManager.cs +++ b/Ryujinx.HLE/HOS/Kernel/Memory/KMemoryManager.cs @@ -23,8 +23,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory private const int KMemoryBlockSize = 0x40; - //We need 2 blocks for the case where a big block - //needs to be split in 2, plus one block that will be the new one inserted. + // We need 2 blocks for the case where a big block + // needs to be split in 2, plus one block that will be the new one inserted. private const int MaxBlocksNeededForInsertion = 2; private LinkedList _blocks; @@ -215,13 +215,13 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory if (CodeRegionStart - baseAddress >= addrSpaceEnd - CodeRegionEnd) { - //Has more space before the start of the code region. + // Has more space before the start of the code region. mapBaseAddress = baseAddress; mapAvailableSize = CodeRegionStart - baseAddress; } else { - //Has more space after the end of the code region. + // Has more space after the end of the code region. mapBaseAddress = CodeRegionEnd; mapAvailableSize = addrSpaceEnd - CodeRegionEnd; } @@ -250,8 +250,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory tlsIoRegion.AslrOffset = GetRandomValue(0, aslrMaxOffset >> 21) << 21; } - //Regions are sorted based on ASLR offset. - //When ASLR is disabled, the order is Map, Heap, NewMap and TlsIo. + // Regions are sorted based on ASLR offset. + // When ASLR is disabled, the order is Map, Heap, NewMap and TlsIo. aliasRegion.Start = mapBaseAddress + aliasRegion.AslrOffset; aliasRegion.End = aliasRegion.Start + aliasRegion.Size; heapRegion.Start = mapBaseAddress + heapRegion.AslrOffset; @@ -336,8 +336,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory private KernelResult InitializeBlocks(ulong addrSpaceStart, ulong addrSpaceEnd) { - //First insertion will always need only a single block, - //because there's nothing else to split. + // First insertion will always need only a single block, + // because there's nothing else to split. if (!_blockAllocator.CanAllocate(1)) { return KernelResult.OutOfResource; @@ -466,13 +466,13 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory public KernelResult MapNormalMemory(long address, long size, MemoryPermission permission) { - //TODO. + // TODO. return KernelResult.Success; } public KernelResult MapIoMemory(long address, long size, MemoryPermission permission) { - //TODO. + // TODO. return KernelResult.Success; } @@ -696,7 +696,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory return result; } - //TODO: Missing some checks here. + // TODO: Missing some checks here. if (!_blockAllocator.CanAllocate(MaxBlocksNeededForInsertion * 2)) { @@ -730,7 +730,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory if (currentHeapSize <= size) { - //Expand. + // Expand. ulong diffSize = size - currentHeapSize; lock (_blocks) @@ -800,7 +800,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory } else { - //Shrink. + // Shrink. ulong freeAddr = HeapRegionStart + size; ulong diffSize = currentHeapSize - size; @@ -1147,7 +1147,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory out _, out MemoryAttribute attribute)) { - //TODO: Missing checks. + // TODO: Missing checks. if (!_blockAllocator.CanAllocate(MaxBlocksNeededForInsertion)) { @@ -1225,8 +1225,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory { MemoryState newState = oldState; - //If writing into the code region is allowed, then we need - //to change it to mutable. + // If writing into the code region is allowed, then we need + // to change it to mutable. if ((permission & MemoryPermission.Write) != 0) { if (oldState == MemoryState.CodeStatic) @@ -1362,8 +1362,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory lock (_blocks) { - //Scan, ensure that the region can be unmapped (all blocks are heap or - //already unmapped), fill pages list for freeing memory. + // Scan, ensure that the region can be unmapped (all blocks are heap or + // already unmapped), fill pages list for freeing memory. ulong heapMappedSize = 0; KPageList pageList = new KPageList(); @@ -1400,7 +1400,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory return KernelResult.OutOfResource; } - //Try to unmap all the heap mapped memory inside range. + // Try to unmap all the heap mapped memory inside range. KernelResult result = KernelResult.Success; foreach (KMemoryInfo info in IterateOverRange(address, endAddr)) @@ -1416,7 +1416,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory if (result != KernelResult.Success) { - //If we failed to unmap, we need to remap everything back again. + // If we failed to unmap, we need to remap everything back again. MapPhysicalMemory(pageList, address, blockAddress + blockSize); break; @@ -1508,7 +1508,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory MemoryAttribute attributeMask, MemoryAttribute attributeExpected) { - //Client -> server. + // Client -> server. return CopyDataFromOrToCurrentProcess( size, src, @@ -1531,7 +1531,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory MemoryAttribute attributeExpected, ulong src) { - //Server -> client. + // Server -> client. return CopyDataFromOrToCurrentProcess( size, dst, @@ -1731,7 +1731,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory foreach (KMemoryInfo info in IterateOverRange(address, endAddrRounded)) { - //Check if the block state matches what we expect. + // Check if the block state matches what we expect. if ((info.State & stateMask) != stateMask || (info.Permission & permission) != permission || (info.Attribute & attributeMask) != MemoryAttribute.None) @@ -1830,12 +1830,12 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory ulong unusedSizeAfter; - //When the start address is unaligned, we can't safely map the - //first page as it would expose other undesirable information on the - //target process. So, instead we allocate new pages, copy the data - //inside the range, and then clear the remaining space. - //The same also holds for the last page, if the end address - //(address + size) is also not aligned. + // When the start address is unaligned, we can't safely map the + // first page as it would expose other undesirable information on the + // target process. So, instead we allocate new pages, copy the data + // inside the range, and then clear the remaining space. + // The same also holds for the last page, if the end address + // (address + size) is also not aligned. if (copyData) { ulong unusedSizeBefore = address - addressTruncated; @@ -1883,7 +1883,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory if (endAddrTruncated != endAddrRounded) { - //End is also not aligned... + // End is also not aligned... dstLastPagePa = AllocateSinglePage(region, aslrDisabled); if (dstLastPagePa == 0) @@ -1980,9 +1980,9 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory for (int unit = MappingUnitSizes.Length - 1; unit >= 0 && va == 0; unit--) { - int alignemnt = MappingUnitSizes[unit]; + int alignment = MappingUnitSizes[unit]; - va = AllocateVa(AliasRegionStart, regionPagesCount, neededPagesCount, alignemnt); + va = AllocateVa(AliasRegionStart, regionPagesCount, neededPagesCount, alignment); } if (va == 0) @@ -2109,7 +2109,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory { foreach (KMemoryInfo info in IterateOverRange(address, endAddrTruncated)) { - //Check if the block state matches what we expect. + // Check if the block state matches what we expect. if ((info.State & stateMask) != stateMask || (info.Attribute & attributeMask) != MemoryAttribute.IpcMapped) { @@ -2331,7 +2331,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory { info = node.Value.GetInfo(); - //Check if the block state matches what we expect. + // Check if the block state matches what we expect. if ( firstState != info.State || firstPermission != info.Permission || (info.Attribute & attributeMask) != attributeExpected || @@ -2367,7 +2367,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory { foreach (KMemoryInfo info in IterateOverRange(address, address + size)) { - //Check if the block state matches what we expect. + // Check if the block state matches what we expect. if ((info.State & stateMask) != stateExpected || (info.Permission & permissionMask) != permissionExpected || (info.Attribute & attributeMask) != attributeExpected) @@ -2404,9 +2404,9 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory MemoryPermission newPermission, MemoryAttribute newAttribute) { - //Insert new block on the list only on areas where the state - //of the block matches the state specified on the old* state - //arguments, otherwise leave it as is. + // Insert new block on the list only on areas where the state + // of the block matches the state specified on the old* state + // arguments, otherwise leave it as is. int oldCount = _blocks.Count; oldAttribute |= MemoryAttribute.IpcAndDeviceMapped; @@ -2451,7 +2451,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory newNode.Value.SetState(newPermission, newState, newAttribute); - MergeEqualStateNeighbours(newNode); + MergeEqualStateNeighbors(newNode); } if (currEndAddr - 1 >= endAddr - 1) @@ -2472,8 +2472,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory MemoryPermission permission = MemoryPermission.None, MemoryAttribute attribute = MemoryAttribute.None) { - //Inserts new block at the list, replacing and spliting - //existing blocks as needed. + // Inserts new block at the list, replacing and splitting + // existing blocks as needed. int oldCount = _blocks.Count; ulong endAddr = baseAddress + pagesCount * PageSize; @@ -2505,7 +2505,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory newNode.Value.SetState(permission, state, attribute); - MergeEqualStateNeighbours(newNode); + MergeEqualStateNeighbors(newNode); } if (currEndAddr - 1 >= endAddr - 1) @@ -2537,9 +2537,9 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory BlockMutator blockMutate, MemoryPermission permission = MemoryPermission.None) { - //Inserts new block at the list, replacing and spliting - //existing blocks as needed, then calling the callback - //function on the new block. + // Inserts new block at the list, replacing and splitting + // existing blocks as needed, then calling the callback + // function on the new block. int oldCount = _blocks.Count; ulong endAddr = baseAddress + pagesCount * PageSize; @@ -2573,7 +2573,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory blockMutate(newBlock, permission); - MergeEqualStateNeighbours(newNode); + MergeEqualStateNeighbors(newNode); } if (currEndAddr - 1 >= endAddr - 1) @@ -2587,7 +2587,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory _blockAllocator.Count += _blocks.Count - oldCount; } - private void MergeEqualStateNeighbours(LinkedListNode node) + private void MergeEqualStateNeighbors(LinkedListNode node) { KMemoryBlock block = node.Value; diff --git a/Ryujinx.HLE/HOS/Kernel/Memory/KMemoryRegionManager.cs b/Ryujinx.HLE/HOS/Kernel/Memory/KMemoryRegionManager.cs index 92cef559..bb4989fc 100644 --- a/Ryujinx.HLE/HOS/Kernel/Memory/KMemoryRegionManager.cs +++ b/Ryujinx.HLE/HOS/Kernel/Memory/KMemoryRegionManager.cs @@ -126,21 +126,21 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory ulong blockPagesCount = bestFitBlockSize / KMemoryManager.PageSize; - //Check if this is the best fit for this page size. - //If so, try allocating as much requested pages as possible. + // Check if this is the best fit for this page size. + // If so, try allocating as much requested pages as possible. while (blockPagesCount <= pagesCount) { ulong address = AllocatePagesForOrder(blockIndex, backwards, bestFitBlockSize); - //The address being zero means that no free space was found on that order, - //just give up and try with the next one. + // The address being zero means that no free space was found on that order, + // just give up and try with the next one. if (address == 0) { break; } - //Add new allocated page(s) to the pages list. - //If an error occurs, then free all allocated pages and fail. + // Add new allocated page(s) to the pages list. + // If an error occurs, then free all allocated pages and fail. KernelResult result = pageList.AddRange(address, blockPagesCount); if (result != KernelResult.Success) @@ -159,13 +159,13 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory } } - //Success case, all requested pages were allocated successfully. + // Success case, all requested pages were allocated successfully. if (pagesCount == 0) { return KernelResult.Success; } - //Error case, free allocated pages and return out of memory. + // Error case, free allocated pages and return out of memory. foreach (KPageNode pageNode in pageList) { FreePages(pageNode.Address, pageNode.PagesCount); @@ -321,8 +321,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory if (address != 0) { - //If we are using a larger order than best fit, then we should - //split it into smaller blocks. + // If we are using a larger order than best fit, then we should + // split it into smaller blocks. ulong firstFreeBlockSize = 1UL << block.Order; if (firstFreeBlockSize > bestFitBlockSize) @@ -416,7 +416,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory } } - //Free inside aligned region. + // Free inside aligned region. ulong baseAddress = addressRounded; while (baseAddress < endAddrTruncated) @@ -430,7 +430,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory int nextBlockIndex = blockIndex - 1; - //Free region between Address and aligned region start. + // Free region between Address and aligned region start. baseAddress = addressRounded; for (blockIndex = nextBlockIndex; blockIndex >= 0; blockIndex--) @@ -445,7 +445,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory } } - //Free region between aligned region end and End Address. + // Free region between aligned region end and End Address. baseAddress = endAddrTruncated; for (blockIndex = nextBlockIndex; blockIndex >= 0; blockIndex--) diff --git a/Ryujinx.HLE/HOS/Kernel/Process/HleProcessDebugger.cs b/Ryujinx.HLE/HOS/Kernel/Process/HleProcessDebugger.cs index d31f95b4..223bf5da 100644 --- a/Ryujinx.HLE/HOS/Kernel/Process/HleProcessDebugger.cs +++ b/Ryujinx.HLE/HOS/Kernel/Process/HleProcessDebugger.cs @@ -1,10 +1,8 @@ using ChocolArm64.Memory; using ChocolArm64.State; -using Ryujinx.Common.Logging; using Ryujinx.HLE.HOS.Diagnostics.Demangler; using Ryujinx.HLE.HOS.Kernel.Memory; using Ryujinx.HLE.Loaders.Elf; -using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -75,7 +73,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process } } - //TODO: ARM32. + // TODO: ARM32. long framePointer = (long)threadState.X29; trace.AppendLine($"Process: {_owner.Name}, PID: {_owner.Pid}"); @@ -89,8 +87,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Process break; } - //Note: This is the return address, we need to subtract one instruction - //worth of bytes to get the branch instruction address. + // Note: This is the return address, we need to subtract one instruction + // worth of bytes to get the branch instruction address. AppendTrace(_owner.CpuMemory.ReadInt64(framePointer + 8) - 4); framePointer = _owner.CpuMemory.ReadInt64(framePointer); @@ -245,7 +243,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process long ehHdrEndOffset = memory.ReadInt32(mod0Offset + 0x14) + mod0Offset; long modObjOffset = memory.ReadInt32(mod0Offset + 0x18) + mod0Offset; - //TODO: Elf32. + // TODO: Elf32. while (true) { long tagVal = memory.ReadInt64(dynamicOffset + 0); diff --git a/Ryujinx.HLE/HOS/Kernel/Process/KProcess.cs b/Ryujinx.HLE/HOS/Kernel/Process/KProcess.cs index 909f6333..1b5a6772 100644 --- a/Ryujinx.HLE/HOS/Kernel/Process/KProcess.cs +++ b/Ryujinx.HLE/HOS/Kernel/Process/KProcess.cs @@ -350,7 +350,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process private KernelResult ParseProcessInfo(ProcessCreationInfo creationInfo) { - //Ensure that the current kernel version is equal or above to the minimum required. + // Ensure that the current kernel version is equal or above to the minimum required. uint requiredKernelVersionMajor = (uint)Capabilities.KernelReleaseVersion >> 19; uint requiredKernelVersionMinor = ((uint)Capabilities.KernelReleaseVersion >> 15) & 0xf; @@ -429,7 +429,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process if (_freeTlsPages.Count > 0) { - //If we have free TLS pages available, just use the first one. + // If we have free TLS pages available, just use the first one. KTlsPageInfo pageInfo = _freeTlsPages.Values.First(); if (!pageInfo.TryGetFreePage(out address)) @@ -448,7 +448,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process } else { - //Otherwise, we need to create a new one. + // Otherwise, we need to create a new one. result = AllocateTlsPage(out KTlsPageInfo pageInfo); if (result == KernelResult.Success) @@ -522,7 +522,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process if (_fullTlsPages.TryGetValue(tlsPageAddr, out pageInfo)) { - //TLS page was full, free slot and move to free pages tree. + // TLS page was full, free slot and move to free pages tree. _fullTlsPages.Remove(tlsPageAddr); _freeTlsPages.Add(tlsPageAddr, pageInfo); @@ -538,8 +538,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Process if (pageInfo.IsEmpty()) { - //TLS page is now empty, we should ensure it is removed - //from all trees, and free the memory it was using. + // TLS page is now empty, we should ensure it is removed + // from all trees, and free the memory it was using. _freeTlsPages.Remove(tlsPageAddr); System.CriticalSection.Leave(); @@ -574,7 +574,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process private void GenerateRandomEntropy() { - //TODO. + // TODO. } public KernelResult Start(int mainThreadPriority, ulong stackSize) @@ -603,9 +603,9 @@ namespace Ryujinx.HLE.HOS.Kernel.Process ulong neededSize = stackSizeRounded + _imageSize; - //Check if the needed size for the code and the stack will fit on the - //memory usage capacity of this Process. Also check for possible overflow - //on the above addition. + // Check if the needed size for the code and the stack will fit on the + // memory usage capacity of this Process. Also check for possible overflow + // on the above addition. if (neededSize > _memoryUsageCapacity || neededSize < stackSizeRounded) { @@ -742,10 +742,10 @@ namespace Ryujinx.HLE.HOS.Kernel.Process SetState(newState); - //TODO: We can't call KThread.Start from a non-guest thread. - //We will need to make some changes to allow the creation of - //dummy threads that will be used to initialize the current - //thread on KCoreContext so that GetCurrentThread doesn't fail. + // TODO: We can't call KThread.Start from a non-guest thread. + // We will need to make some changes to allow the creation of + // dummy threads that will be used to initialize the current + // thread on KCoreContext so that GetCurrentThread doesn't fail. /* Result = MainThread.Start(); if (Result != KernelResult.Success) @@ -935,7 +935,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process if (shallTerminate) { - //UnpauseAndTerminateAllThreadsExcept(System.Scheduler.GetCurrentThread()); + // UnpauseAndTerminateAllThreadsExcept(System.Scheduler.GetCurrentThread()); HandleTable.Destroy(); @@ -948,12 +948,12 @@ namespace Ryujinx.HLE.HOS.Kernel.Process private void UnpauseAndTerminateAllThreadsExcept(KThread thread) { - //TODO. + // TODO. } private void SignalExitForDebugEvent() { - //TODO: Debug events. + // TODO: Debug events. } private void SignalExit() diff --git a/Ryujinx.HLE/HOS/Kernel/Process/KProcessCapabilities.cs b/Ryujinx.HLE/HOS/Kernel/Process/KProcessCapabilities.cs index 964762bb..2396aea8 100644 --- a/Ryujinx.HLE/HOS/Kernel/Process/KProcessCapabilities.cs +++ b/Ryujinx.HLE/HOS/Kernel/Process/KProcessCapabilities.cs @@ -131,7 +131,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process int codeMask = 1 << (32 - BitUtils.CountLeadingZeros32(code + 1)); - //Check if the property was already set. + // Check if the property was already set. if (((mask0 & codeMask) & 0x1e008) != 0) { return KernelResult.InvalidCombination; @@ -223,7 +223,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process case 0x800: { - //TODO: GIC distributor check. + // TODO: GIC distributor check. int irq0 = (cap >> 12) & 0x3ff; int irq1 = (cap >> 22) & 0x3ff; @@ -256,7 +256,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process case 0x4000: { - //Note: This check is bugged on kernel too, we are just replicating the bug here. + // Note: This check is bugged on kernel too, we are just replicating the bug here. if ((KernelReleaseVersion >> 17) != 0 || cap < 0x80000) { return KernelResult.ReservedValue; diff --git a/Ryujinx.HLE/HOS/Kernel/SupervisorCall/SvcSystem.cs b/Ryujinx.HLE/HOS/Kernel/SupervisorCall/SvcSystem.cs index efc10512..5f971131 100644 --- a/Ryujinx.HLE/HOS/Kernel/SupervisorCall/SvcSystem.cs +++ b/Ryujinx.HLE/HOS/Kernel/SupervisorCall/SvcSystem.cs @@ -161,7 +161,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall process = thread.Owner; } - //TODO: KDebugEvent. + // TODO: KDebugEvent. } pid = process?.Pid ?? 0; @@ -549,10 +549,10 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall switch (id) { - //Memory region capacity. + // Memory region capacity. case 0: value = (long)region.Size; break; - //Memory region free space. + // Memory region free space. case 1: { ulong freePagesCount = region.GetFreePages(); diff --git a/Ryujinx.HLE/HOS/Kernel/SupervisorCall/SvcTable.cs b/Ryujinx.HLE/HOS/Kernel/SupervisorCall/SvcTable.cs index dd98e8a0..23934649 100644 --- a/Ryujinx.HLE/HOS/Kernel/SupervisorCall/SvcTable.cs +++ b/Ryujinx.HLE/HOS/Kernel/SupervisorCall/SvcTable.cs @@ -151,10 +151,10 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } } - //For functions returning output values, the first registers - //are used to hold pointers where the value will be stored, - //so they can't be used to pass argument and we must - //skip them. + // For functions returning output values, the first registers + // are used to hold pointers where the value will be stored, + // so they can't be used to pass argument and we must + // skip them. int byRefArgsCount = 0; for (int index = 0; index < methodArgs.Length; index++) @@ -165,7 +165,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall } } - //Print all the arguments for debugging purposes. + // Print all the arguments for debugging purposes. int inputArgsCount = methodArgs.Length - byRefArgsCount; generator.Emit(OpCodes.Ldc_I4_S, inputArgsCount); @@ -200,7 +200,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall generator.Emit(OpCodes.Call, printArgsMethod); - //Call the SVC function handler. + // Call the SVC function handler. generator.Emit(OpCodes.Ldarg_0); List locals = new List(); @@ -239,7 +239,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall Type retType = methodInfo.ReturnType; - //Print result code. + // Print result code. if (retType == typeof(KernelResult)) { MethodInfo printResultMethod = typeof(SvcTable).GetMethod(nameof(PrintResult), staticNonPublic); @@ -249,7 +249,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall generator.Emit(OpCodes.Call, printResultMethod); } - //Save return value into register X0 (when the method has a return value). + // Save return value into register X0 (when the method has a return value). if (retType != typeof(void)) { CheckIfTypeIsSupported(retType, svcName); @@ -275,7 +275,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall generator.Emit(OpCodes.Stfld, GetStateFieldX(outRegIndex++)); } - //Zero out the remaining unused registers. + // Zero out the remaining unused registers. while (outRegIndex < SvcFuncMaxArguments) { generator.Emit(OpCodes.Ldarg_1); diff --git a/Ryujinx.HLE/HOS/Kernel/SupervisorCall/SvcThread.cs b/Ryujinx.HLE/HOS/Kernel/SupervisorCall/SvcThread.cs index fa0b3a6c..e1f018c1 100644 --- a/Ryujinx.HLE/HOS/Kernel/SupervisorCall/SvcThread.cs +++ b/Ryujinx.HLE/HOS/Kernel/SupervisorCall/SvcThread.cs @@ -175,7 +175,7 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall public KernelResult SetThreadPriority(int handle, int priority) { - //TODO: NPDM check. + // TODO: NPDM check. KThread thread = _process.HandleTable.GetKThread(handle); diff --git a/Ryujinx.HLE/HOS/Kernel/Threading/HleScheduler.cs b/Ryujinx.HLE/HOS/Kernel/Threading/HleScheduler.cs index d5dbb4d8..42eed26a 100644 --- a/Ryujinx.HLE/HOS/Kernel/Threading/HleScheduler.cs +++ b/Ryujinx.HLE/HOS/Kernel/Threading/HleScheduler.cs @@ -68,8 +68,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading if (hasThreadExecuting) { - //If this is not the thread that is currently executing, we need - //to request an interrupt to allow safely starting another thread. + // If this is not the thread that is currently executing, we need + // to request an interrupt to allow safely starting another thread. if (!currentThread.Context.IsCurrentThread()) { currentThread.Context.RequestInterrupt(); @@ -80,8 +80,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading CoreManager.Reset(currentThread.Context.Work); } - //Advance current core and try picking a thread, - //keep advancing if it is null. + // Advance current core and try picking a thread, + // keep advancing if it is null. for (int core = 0; core < 4; core++) { _currentCore = (_currentCore + 1) % CpuCoresCount; @@ -100,8 +100,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading } } - //If nothing was running before, then we are on a "external" - //HLE thread, we don't need to wait. + // If nothing was running before, then we are on a "external" + // HLE thread, we don't need to wait. if (!hasThreadExecuting) { return; @@ -114,9 +114,9 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading private void PreemptCurrentThread() { - //Preempts current thread every 10 milliseconds on a round-robin fashion, - //when multi core scheduling is disabled, to try ensuring that all threads - //gets a chance to run. + // Preempts current thread every 10 milliseconds on a round-robin fashion, + // when multi core scheduling is disabled, to try ensuring that all threads + // gets a chance to run. while (_keepPreempting) { lock (CoreContexts) diff --git a/Ryujinx.HLE/HOS/Kernel/Threading/KAddressArbiter.cs b/Ryujinx.HLE/HOS/Kernel/Threading/KAddressArbiter.cs index b11df61e..166cf064 100644 --- a/Ryujinx.HLE/HOS/Kernel/Threading/KAddressArbiter.cs +++ b/Ryujinx.HLE/HOS/Kernel/Threading/KAddressArbiter.cs @@ -207,7 +207,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading signaledThreads.Enqueue(thread); - //If the count is <= 0, we should signal all threads waiting. + // If the count is <= 0, we should signal all threads waiting. if (count >= 1 && --count == 0) { break; @@ -234,7 +234,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading { if (!KernelTransfer.UserToKernelInt32(_system, address, out mutexValue)) { - //Invalid address. + // Invalid address. requester.SignaledObj = null; requester.ObjSyncResult = KernelResult.InvalidMemState; @@ -243,12 +243,12 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading if (mutexValue != 0) { - //Update value to indicate there is a mutex waiter now. + // Update value to indicate there is a mutex waiter now. newMutexValue = mutexValue | HasListenersMask; } else { - //No thread owning the mutex, assign to requesting thread. + // No thread owning the mutex, assign to requesting thread. newMutexValue = requester.ThreadHandleForUserMutex; } } @@ -256,7 +256,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading if (mutexValue == 0) { - //We now own the mutex. + // We now own the mutex. requester.SignaledObj = null; requester.ObjSyncResult = KernelResult.Success; @@ -271,12 +271,12 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading if (mutexOwner != null) { - //Mutex already belongs to another thread, wait for it. + // Mutex already belongs to another thread, wait for it. mutexOwner.AddMutexWaiter(requester); } else { - //Invalid mutex owner. + // Invalid mutex owner. requester.SignaledObj = null; requester.ObjSyncResult = KernelResult.InvalidHandle; @@ -513,9 +513,9 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading int offset; - //The value is decremented if the number of threads waiting is less - //or equal to the Count of threads to be signaled, or Count is zero - //or negative. It is incremented if there are no threads waiting. + // The value is decremented if the number of threads waiting is less + // or equal to the Count of threads to be signaled, or Count is zero + // or negative. It is incremented if there are no threads waiting. int waitingCount = 0; foreach (KThread thread in ArbiterThreads.Where(x => x.MutexAddress == address)) @@ -572,7 +572,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading { signaledThreads.Enqueue(thread); - //If the count is <= 0, we should signal all threads waiting. + // If the count is <= 0, we should signal all threads waiting. if (count >= 1 && --count == 0) { break; diff --git a/Ryujinx.HLE/HOS/Kernel/Threading/KCriticalSection.cs b/Ryujinx.HLE/HOS/Kernel/Threading/KCriticalSection.cs index 841d0d69..39c857b5 100644 --- a/Ryujinx.HLE/HOS/Kernel/Threading/KCriticalSection.cs +++ b/Ryujinx.HLE/HOS/Kernel/Threading/KCriticalSection.cs @@ -57,17 +57,17 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading if (currentHleThread == null) { - //Nothing is running, we can perform the context switch immediately. + // Nothing is running, we can perform the context switch immediately. coreContext.ContextSwitch(); } else if (currentHleThread.IsCurrentThread()) { - //Thread running on the current core, context switch will block. + // Thread running on the current core, context switch will block. doContextSwitch = true; } else { - //Thread running on another core, request a interrupt. + // Thread running on another core, request a interrupt. currentHleThread.RequestInterrupt(); } } diff --git a/Ryujinx.HLE/HOS/Kernel/Threading/KScheduler.cs b/Ryujinx.HLE/HOS/Kernel/Threading/KScheduler.cs index c9686df3..8d2cdfce 100644 --- a/Ryujinx.HLE/HOS/Kernel/Threading/KScheduler.cs +++ b/Ryujinx.HLE/HOS/Kernel/Threading/KScheduler.cs @@ -55,7 +55,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading KThread selectedThread = scheduledThreads.FirstOrDefault(x => x.DynamicPriority == prio); - //Yield priority queue. + // Yield priority queue. if (selectedThread != null) { SchedulingData.Reschedule(prio, core, selectedThread); @@ -82,7 +82,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading } } - //If the candidate was scheduled after the current thread, then it's not worth it. + // If the candidate was scheduled after the current thread, then it's not worth it. if (selectedThread == null || selectedThread.LastScheduledTime >= thread.LastScheduledTime) { yield return thread; @@ -90,8 +90,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading } } - //Select candidate threads that could run on this core. - //Only take into account threads that are not yet selected. + // Select candidate threads that could run on this core. + // Only take into account threads that are not yet selected. KThread dst = SuitableCandidates().FirstOrDefault(x => x.DynamicPriority == prio); if (dst != null) @@ -101,8 +101,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading selectedThread = dst; } - //If the priority of the currently selected thread is lower than preemption priority, - //then allow threads with lower priorities to be selected aswell. + // If the priority of the currently selected thread is lower than preemption priority, + // then allow threads with lower priorities to be selected aswell. if (selectedThread != null && selectedThread.DynamicPriority > prio) { Func predicate = x => x.DynamicPriority >= selectedThread.DynamicPriority; @@ -131,8 +131,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading for (int core = 0; core < CpuCoresCount; core++) { - //If the core is not idle (there's already a thread running on it), - //then we don't need to attempt load balancing. + // If the core is not idle (there's already a thread running on it), + // then we don't need to attempt load balancing. if (SchedulingData.ScheduledThreads(core).Any()) { continue; @@ -144,8 +144,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading KThread dst = null; - //Select candidate threads that could run on this core. - //Give preference to threads that are not yet selected. + // Select candidate threads that could run on this core. + // Give preference to threads that are not yet selected. foreach (KThread thread in SchedulingData.SuggestedThreads(core)) { if (thread.CurrentCore < 0 || thread != CoreContexts[thread.CurrentCore].SelectedThread) @@ -158,11 +158,11 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading srcCoresHighestPrioThreads[srcCoresHighestPrioThreadsCount++] = thread.CurrentCore; } - //Not yet selected candidate found. + // Not yet selected candidate found. if (dst != null) { - //Priorities < 2 are used for the kernel message dispatching - //threads, we should skip load balancing entirely. + // Priorities < 2 are used for the kernel message dispatching + // threads, we should skip load balancing entirely. if (dst.DynamicPriority >= 2) { SchedulingData.TransferToCore(dst.DynamicPriority, core, dst); @@ -173,8 +173,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading continue; } - //All candiates are already selected, choose the best one - //(the first one that doesn't make the source core idle if moved). + // All candidates are already selected, choose the best one + // (the first one that doesn't make the source core idle if moved). for (int index = 0; index < srcCoresHighestPrioThreadsCount; index++) { int srcCore = srcCoresHighestPrioThreads[index]; @@ -183,8 +183,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading if (src != null) { - //Run the second thread on the queue on the source core, - //move the first one to the current core. + // Run the second thread on the queue on the source core, + // move the first one to the current core. KThread origSelectedCoreSrc = CoreContexts[srcCore].SelectedThread; CoreContexts[srcCore].SelectThread(src); diff --git a/Ryujinx.HLE/HOS/Kernel/Threading/KSynchronization.cs b/Ryujinx.HLE/HOS/Kernel/Threading/KSynchronization.cs index 327b0418..865551a2 100644 --- a/Ryujinx.HLE/HOS/Kernel/Threading/KSynchronization.cs +++ b/Ryujinx.HLE/HOS/Kernel/Threading/KSynchronization.cs @@ -20,7 +20,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading _system.CriticalSection.Enter(); - //Check if objects are already signaled before waiting. + // Check if objects are already signaled before waiting. for (int index = 0; index < syncObjs.Length; index++) { if (!syncObjs[index].IsSignaled()) diff --git a/Ryujinx.HLE/HOS/Kernel/Threading/KThread.cs b/Ryujinx.HLE/HOS/Kernel/Threading/KThread.cs index ebde34ba..50c71ea9 100644 --- a/Ryujinx.HLE/HOS/Kernel/Threading/KThread.cs +++ b/Ryujinx.HLE/HOS/Kernel/Threading/KThread.cs @@ -276,7 +276,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading public void Exit() { - //TODO: Debug event. + // TODO: Debug event. if (Owner != null) { @@ -352,7 +352,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading if (DynamicPriority < KScheduler.PrioritiesCount) { - //Move current thread to the end of the queue. + // Move current thread to the end of the queue. _schedulingData.Reschedule(DynamicPriority, CurrentCore, this); } @@ -383,7 +383,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading if (DynamicPriority < KScheduler.PrioritiesCount) { - //Move current thread to the end of the queue. + // Move current thread to the end of the queue. _schedulingData.Reschedule(prio, core, this); Func predicate = x => x.DynamicPriority == prio; @@ -407,8 +407,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading } } - //If the candidate was scheduled after the current thread, then it's not worth it, - //unless the priority is higher than the current one. + // If the candidate was scheduled after the current thread, then it's not worth it, + // unless the priority is higher than the current one. if (nextThreadOnCurrentQueue.LastScheduledTime >= thread.LastScheduledTime || nextThreadOnCurrentQueue.DynamicPriority < thread.DynamicPriority) { @@ -524,7 +524,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading { if (pause) { - //Pause, the force pause flag should be clear (thread is NOT paused). + // Pause, the force pause flag should be clear (thread is NOT paused). if ((_forcePauseFlags & ThreadSchedState.ThreadPauseFlag) == 0) { _forcePauseFlags |= ThreadSchedState.ThreadPauseFlag; @@ -538,7 +538,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading } else { - //Unpause, the force pause flag should be set (thread is paused). + // Unpause, the force pause flag should be set (thread is paused). if ((_forcePauseFlags & ThreadSchedState.ThreadPauseFlag) != 0) { ThreadSchedState oldForcePauseFlags = _forcePauseFlags; @@ -604,7 +604,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading bool useOverride = _affinityOverrideCount != 0; - //The value -3 is "do not change the preferred core". + // The value -3 is "do not change the preferred core". if (newCore == -3) { newCore = useOverride ? _preferredCoreOverride : PreferredCore; @@ -766,7 +766,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading do { - //Skip all threads that are not waiting for this mutex. + // Skip all threads that are not waiting for this mutex. while (currentNode != null && currentNode.Value.MutexAddress != mutexAddress) { currentNode = currentNode.Next; @@ -785,12 +785,12 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading if (newMutexOwner != null) { - //New owner was already selected, re-insert on new owner list. + // New owner was already selected, re-insert on new owner list. newMutexOwner.AddToMutexWaitersList(currentNode.Value); } else { - //New owner not selected yet, use current thread. + // New owner not selected yet, use current thread. newMutexOwner = currentNode.Value; } @@ -812,9 +812,9 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading private void UpdatePriorityInheritance() { - //If any of the threads waiting for the mutex has - //higher priority than the current thread, then - //the current thread inherits that priority. + // If any of the threads waiting for the mutex has + // higher priority than the current thread, then + // the current thread inherits that priority. int highestPriority = BasePriority; if (_mutexWaiters.First != null) @@ -837,7 +837,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading if (MutexOwner != null) { - //Remove and re-insert to ensure proper sorting based on new priority. + // Remove and re-insert to ensure proper sorting based on new priority. MutexOwner._mutexWaiters.Remove(_mutexWaiterNode); MutexOwner.AddToMutexWaitersList(this); @@ -877,7 +877,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading if (oldFlags == ThreadSchedState.Running) { - //Was running, now it's stopped. + // Was running, now it's stopped. if (CurrentCore >= 0) { _schedulingData.Unschedule(DynamicPriority, CurrentCore, this); @@ -893,7 +893,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading } else if (SchedFlags == ThreadSchedState.Running) { - //Was stopped, now it's running. + // Was stopped, now it's running. if (CurrentCore >= 0) { _schedulingData.Schedule(DynamicPriority, CurrentCore, this); @@ -918,7 +918,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading return; } - //Remove thread from the old priority queues. + // Remove thread from the old priority queues. if (CurrentCore >= 0) { _schedulingData.Unschedule(oldPriority, CurrentCore, this); @@ -932,7 +932,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading } } - //Add thread to the new priority queues. + // Add thread to the new priority queues. KThread currentThread = _scheduler.GetCurrentThread(); if (CurrentCore >= 0) @@ -965,7 +965,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading return; } - //Remove thread from the old priority queues. + // Remove thread from the old priority queues. for (int core = 0; core < KScheduler.CpuCoresCount; core++) { if (((oldAffinityMask >> core) & 1) != 0) @@ -981,7 +981,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading } } - //Add thread to the new priority queues. + // Add thread to the new priority queues. for (int core = 0; core < KScheduler.CpuCoresCount; core++) { if (((AffinityMask >> core) & 1) != 0) @@ -1069,7 +1069,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Threading System.CriticalSection.Enter(); - //Wake up all threads that may be waiting for a mutex being held by this thread. + // Wake up all threads that may be waiting for a mutex being held by this thread. foreach (KThread thread in _mutexWaiters) { thread.MutexOwner = null; diff --git a/Ryujinx.HLE/HOS/ProgramLoader.cs b/Ryujinx.HLE/HOS/ProgramLoader.cs index a41df557..af974e18 100644 --- a/Ryujinx.HLE/HOS/ProgramLoader.cs +++ b/Ryujinx.HLE/HOS/ProgramLoader.cs @@ -38,7 +38,7 @@ namespace Ryujinx.HLE.HOS if (AslrEnabled) { - //TODO: Randomization. + // TODO: Randomization. mmuFlags |= 0x20; } diff --git a/Ryujinx.HLE/HOS/Services/Am/IApplicationCreator.cs b/Ryujinx.HLE/HOS/Services/Am/IApplicationCreator.cs index eac609ed..5f31b323 100644 --- a/Ryujinx.HLE/HOS/Services/Am/IApplicationCreator.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IApplicationCreator.cs @@ -13,7 +13,7 @@ namespace Ryujinx.HLE.HOS.Services.Am { _commands = new Dictionary { - //... + // ... }; } } diff --git a/Ryujinx.HLE/HOS/Services/Am/IApplicationFunctions.cs b/Ryujinx.HLE/HOS/Services/Am/IApplicationFunctions.cs index 41bfb1c8..dc8adb93 100644 --- a/Ryujinx.HLE/HOS/Services/Am/IApplicationFunctions.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IApplicationFunctions.cs @@ -28,7 +28,7 @@ namespace Ryujinx.HLE.HOS.Services.Am public long PopLaunchParameter(ServiceCtx context) { - //Only the first 0x18 bytes of the Data seems to be actually used. + // Only the first 0x18 bytes of the Data seems to be actually used. MakeObject(context, new IStorage(StorageHelper.MakeLaunchParams())); return 0; @@ -74,7 +74,7 @@ namespace Ryujinx.HLE.HOS.Services.Am public long GetDisplayVersion(ServiceCtx context) { - //FIXME: Need to check correct version on a switch. + // FIXME: Need to check correct version on a switch. context.ResponseData.Write(1L); context.ResponseData.Write(0L); diff --git a/Ryujinx.HLE/HOS/Services/Am/IDebugFunctions.cs b/Ryujinx.HLE/HOS/Services/Am/IDebugFunctions.cs index f7ea253d..a884a454 100644 --- a/Ryujinx.HLE/HOS/Services/Am/IDebugFunctions.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IDebugFunctions.cs @@ -13,7 +13,7 @@ namespace Ryujinx.HLE.HOS.Services.Am { _commands = new Dictionary { - //... + // ... }; } } diff --git a/Ryujinx.HLE/HOS/Services/Am/IDisplayController.cs b/Ryujinx.HLE/HOS/Services/Am/IDisplayController.cs index 91fd864c..fc668f3c 100644 --- a/Ryujinx.HLE/HOS/Services/Am/IDisplayController.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IDisplayController.cs @@ -13,7 +13,7 @@ namespace Ryujinx.HLE.HOS.Services.Am { _commands = new Dictionary { - //... + // ... }; } } diff --git a/Ryujinx.HLE/HOS/Services/Am/IGlobalStateController.cs b/Ryujinx.HLE/HOS/Services/Am/IGlobalStateController.cs index b9387661..634f65eb 100644 --- a/Ryujinx.HLE/HOS/Services/Am/IGlobalStateController.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IGlobalStateController.cs @@ -13,7 +13,7 @@ namespace Ryujinx.HLE.HOS.Services.Am { _commands = new Dictionary { - //... + // ... }; } } diff --git a/Ryujinx.HLE/HOS/Services/Am/IHomeMenuFunctions.cs b/Ryujinx.HLE/HOS/Services/Am/IHomeMenuFunctions.cs index e61fccb2..868e0215 100644 --- a/Ryujinx.HLE/HOS/Services/Am/IHomeMenuFunctions.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IHomeMenuFunctions.cs @@ -23,7 +23,7 @@ namespace Ryujinx.HLE.HOS.Services.Am { 21, GetPopFromGeneralChannelEvent } }; - //ToDo: Signal this Event somewhere in future. + // TODO: Signal this Event somewhere in future. _channelEvent = new KEvent(system); } diff --git a/Ryujinx.HLE/HOS/Services/Am/IStorageAccessor.cs b/Ryujinx.HLE/HOS/Services/Am/IStorageAccessor.cs index ac54069a..ac44e444 100644 --- a/Ryujinx.HLE/HOS/Services/Am/IStorageAccessor.cs +++ b/Ryujinx.HLE/HOS/Services/Am/IStorageAccessor.cs @@ -33,7 +33,7 @@ namespace Ryujinx.HLE.HOS.Services.Am public long Write(ServiceCtx context) { - //TODO: Error conditions. + // TODO: Error conditions. long writePosition = context.RequestData.ReadInt64(); (long position, long size) = context.Request.GetBufferType0x21(); @@ -57,7 +57,7 @@ namespace Ryujinx.HLE.HOS.Services.Am public long Read(ServiceCtx context) { - //TODO: Error conditions. + // TODO: Error conditions. long readPosition = context.RequestData.ReadInt64(); (long position, long size) = context.Request.GetBufferType0x22(); diff --git a/Ryujinx.HLE/HOS/Services/Am/StorageHelper.cs b/Ryujinx.HLE/HOS/Services/Am/StorageHelper.cs index 39a4c6dd..a3dbbeb7 100644 --- a/Ryujinx.HLE/HOS/Services/Am/StorageHelper.cs +++ b/Ryujinx.HLE/HOS/Services/Am/StorageHelper.cs @@ -8,7 +8,7 @@ namespace Ryujinx.HLE.HOS.Services.Am public static byte[] MakeLaunchParams() { - //Size needs to be at least 0x88 bytes otherwise application errors. + // Size needs to be at least 0x88 bytes otherwise application errors. using (MemoryStream ms = new MemoryStream()) { BinaryWriter writer = new BinaryWriter(ms); diff --git a/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/IAudioRenderer.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/IAudioRenderer.cs index 8c984385..2fbb041a 100644 --- a/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/IAudioRenderer.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/IAudioRenderer.cs @@ -16,11 +16,11 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer { class IAudioRenderer : IpcService, IDisposable { - //This is the amount of samples that are going to be appended - //each time that RequestUpdateAudioRenderer is called. Ideally, - //this value shouldn't be neither too small (to avoid the player - //starving due to running out of samples) or too large (to avoid - //high latency). + // This is the amount of samples that are going to be appended + // each time that RequestUpdateAudioRenderer is called. Ideally, + // this value shouldn't be neither too small (to avoid the player + // starving due to running out of samples) or too large (to avoid + // high latency). private const int MixBufferSamplesCount = 960; private Dictionary _commands; diff --git a/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/VoiceChannelResourceIn.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/VoiceChannelResourceIn.cs index 2a6f424f..4933a79b 100644 --- a/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/VoiceChannelResourceIn.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/VoiceChannelResourceIn.cs @@ -5,6 +5,6 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer [StructLayout(LayoutKind.Sequential, Size = 0x70, Pack = 1)] struct VoiceChannelResourceIn { - //??? + // ??? } } diff --git a/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/VoiceContext.cs b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/VoiceContext.cs index 5de85612..971563dc 100644 --- a/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/VoiceContext.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/AudioRenderer/VoiceContext.cs @@ -46,7 +46,7 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer { if (_acquired && !newState) { - //Release. + // Release. Reset(); } @@ -124,9 +124,9 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer private void UpdateBuffer(MemoryManager memory) { - //TODO: Implement conversion for formats other - //than interleaved stereo (2 channels). - //As of now, it assumes that HostChannelsCount == 2. + // TODO: Implement conversion for formats other + // than interleaved stereo (2 channels). + // As of now, it assumes that HostChannelsCount == 2. WaveBuffer wb = WaveBuffers[_bufferIndex]; if (wb.Position == 0) @@ -173,9 +173,9 @@ namespace Ryujinx.HLE.HOS.Services.Aud.AudioRenderer if (SampleRate != AudioConsts.HostSampleRate) { - //TODO: We should keep the frames being discarded (see the 4 below) - //on a buffer and include it on the next samples buffer, to allow - //the resampler to do seamless interpolation between wave buffers. + // TODO: We should keep the frames being discarded (see the 4 below) + // on a buffer and include it on the next samples buffer, to allow + // the resampler to do seamless interpolation between wave buffers. int samplesCount = _samples.Length / AudioConsts.HostChannelsCount; samplesCount = Math.Max(samplesCount - 4, 0); diff --git a/Ryujinx.HLE/HOS/Services/Aud/IAudioDevice.cs b/Ryujinx.HLE/HOS/Services/Aud/IAudioDevice.cs index 4be183fa..d4946999 100644 --- a/Ryujinx.HLE/HOS/Services/Aud/IAudioDevice.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/IAudioDevice.cs @@ -36,7 +36,7 @@ namespace Ryujinx.HLE.HOS.Services.Aud _systemEvent = new KEvent(system); - //TODO: We shouldn't be signaling this here. + // TODO: We shouldn't be signaling this here. _systemEvent.ReadableEvent.Signal(); } diff --git a/Ryujinx.HLE/HOS/Services/Aud/IHardwareOpusDecoder.cs b/Ryujinx.HLE/HOS/Services/Aud/IHardwareOpusDecoder.cs index fc0bd8db..68b02bcc 100644 --- a/Ryujinx.HLE/HOS/Services/Aud/IHardwareOpusDecoder.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/IHardwareOpusDecoder.cs @@ -37,8 +37,8 @@ namespace Ryujinx.HLE.HOS.Services.Aud { long result = DecodeInterleaved(context); - //TODO: Figure out what this value is. - //According to switchbrew, it is now used. + // TODO: Figure out what this value is. + // According to switchbrew, it is now used. context.ResponseData.Write(0L); return result; diff --git a/Ryujinx.HLE/HOS/Services/Aud/IHardwareOpusDecoderManager.cs b/Ryujinx.HLE/HOS/Services/Aud/IHardwareOpusDecoderManager.cs index 495c8ab4..0b5e12f0 100644 --- a/Ryujinx.HLE/HOS/Services/Aud/IHardwareOpusDecoderManager.cs +++ b/Ryujinx.HLE/HOS/Services/Aud/IHardwareOpusDecoderManager.cs @@ -30,7 +30,7 @@ namespace Ryujinx.HLE.HOS.Services.Aud public long GetWorkBufferSize(ServiceCtx context) { - //Note: The sample rate is ignored because it is fixed to 48KHz. + // Note: The sample rate is ignored because it is fixed to 48KHz. int sampleRate = context.RequestData.ReadInt32(); int channelsCount = context.RequestData.ReadInt32(); diff --git a/Ryujinx.HLE/HOS/Services/Bcat/IBcatService.cs b/Ryujinx.HLE/HOS/Services/Bcat/IBcatService.cs index 051b75d6..dfd67304 100644 --- a/Ryujinx.HLE/HOS/Services/Bcat/IBcatService.cs +++ b/Ryujinx.HLE/HOS/Services/Bcat/IBcatService.cs @@ -13,7 +13,7 @@ namespace Ryujinx.HLE.HOS.Services.Bcat { _commands = new Dictionary { - //... + // ... }; } diff --git a/Ryujinx.HLE/HOS/Services/Bcat/IDeliveryCacheStorageService.cs b/Ryujinx.HLE/HOS/Services/Bcat/IDeliveryCacheStorageService.cs index 043cb607..fcf81c7e 100644 --- a/Ryujinx.HLE/HOS/Services/Bcat/IDeliveryCacheStorageService.cs +++ b/Ryujinx.HLE/HOS/Services/Bcat/IDeliveryCacheStorageService.cs @@ -13,7 +13,7 @@ namespace Ryujinx.HLE.HOS.Services.Bcat { _commands = new Dictionary { - //... + // ... }; } diff --git a/Ryujinx.HLE/HOS/Services/Caps/IAlbumAccessorService.cs b/Ryujinx.HLE/HOS/Services/Caps/IAlbumAccessorService.cs index 7b334ac4..82da2451 100644 --- a/Ryujinx.HLE/HOS/Services/Caps/IAlbumAccessorService.cs +++ b/Ryujinx.HLE/HOS/Services/Caps/IAlbumAccessorService.cs @@ -13,7 +13,7 @@ namespace Ryujinx.HLE.HOS.Services.Caps { _commands = new Dictionary { - //... + // ... }; } } diff --git a/Ryujinx.HLE/HOS/Services/Caps/IScreenshotService.cs b/Ryujinx.HLE/HOS/Services/Caps/IScreenshotService.cs index 63b155e0..9273b394 100644 --- a/Ryujinx.HLE/HOS/Services/Caps/IScreenshotService.cs +++ b/Ryujinx.HLE/HOS/Services/Caps/IScreenshotService.cs @@ -13,7 +13,7 @@ namespace Ryujinx.HLE.HOS.Services.Caps { _commands = new Dictionary { - //... + // ... }; } } diff --git a/Ryujinx.HLE/HOS/Services/Friend/IDaemonSuspendSessionService.cs b/Ryujinx.HLE/HOS/Services/Friend/IDaemonSuspendSessionService.cs index d0edf29e..b1f23dd5 100644 --- a/Ryujinx.HLE/HOS/Services/Friend/IDaemonSuspendSessionService.cs +++ b/Ryujinx.HLE/HOS/Services/Friend/IDaemonSuspendSessionService.cs @@ -13,7 +13,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend { _commands = new Dictionary { - //... + // ... }; } } diff --git a/Ryujinx.HLE/HOS/Services/Friend/IFriendService.cs b/Ryujinx.HLE/HOS/Services/Friend/IFriendService.cs index 17a32b00..35f40818 100644 --- a/Ryujinx.HLE/HOS/Services/Friend/IFriendService.cs +++ b/Ryujinx.HLE/HOS/Services/Friend/IFriendService.cs @@ -108,7 +108,7 @@ namespace Ryujinx.HLE.HOS.Services.Friend long position = context.Request.PtrBuff[0].Position; long size = context.Request.PtrBuff[0].Size; - //Todo: Write the buffer content. + // TODO: Write the buffer content. Logger.PrintStub(LogClass.ServiceFriend, new { UserId = uuid.ToString(), unknown0 }); diff --git a/Ryujinx.HLE/HOS/Services/FspSrv/IFile.cs b/Ryujinx.HLE/HOS/Services/FspSrv/IFile.cs index 0b8b31fb..48239940 100644 --- a/Ryujinx.HLE/HOS/Services/FspSrv/IFile.cs +++ b/Ryujinx.HLE/HOS/Services/FspSrv/IFile.cs @@ -29,7 +29,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv }; _baseFile = baseFile; - Path = LibHac.Fs.PathTools.Normalize(path); + Path = PathTools.Normalize(path); } // Read(u32 readOption, u64 offset, u64 size) -> (u64 out_size, buffer out_buf) diff --git a/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystem.cs b/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystem.cs index 74ba6216..01a8dc9b 100644 --- a/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystem.cs +++ b/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystem.cs @@ -306,7 +306,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv try { - LibHac.Fs.DirectoryEntryType entryType = _provider.GetEntryType(name); + DirectoryEntryType entryType = _provider.GetEntryType(name); context.ResponseData.Write((int)entryType); } diff --git a/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystemProxy.cs b/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystemProxy.cs index 23989365..7207aaf0 100644 --- a/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystemProxy.cs +++ b/Ryujinx.HLE/HOS/Services/FspSrv/IFileSystemProxy.cs @@ -312,7 +312,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv private void ImportTitleKeysFromNsp(LibHac.Fs.IFileSystem nsp, Keyset keySet) { - foreach (LibHac.Fs.DirectoryEntry ticketEntry in nsp.EnumerateEntries("*.tik")) + foreach (DirectoryEntry ticketEntry in nsp.EnumerateEntries("*.tik")) { Ticket ticket = new Ticket(nsp.OpenFile(ticketEntry.FullPath, OpenMode.Read).AsStream()); diff --git a/Ryujinx.HLE/HOS/Services/FspSrv/IStorage.cs b/Ryujinx.HLE/HOS/Services/FspSrv/IStorage.cs index 75f2c9ee..81bdcdcc 100644 --- a/Ryujinx.HLE/HOS/Services/FspSrv/IStorage.cs +++ b/Ryujinx.HLE/HOS/Services/FspSrv/IStorage.cs @@ -32,7 +32,7 @@ namespace Ryujinx.HLE.HOS.Services.FspSrv { IpcBuffDesc buffDesc = context.Request.ReceiveBuff[0]; - //Use smaller length to avoid overflows. + // Use smaller length to avoid overflows. if (size > buffDesc.Size) { size = buffDesc.Size; diff --git a/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs b/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs index e5b56a60..7e48a186 100644 --- a/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs +++ b/Ryujinx.HLE/HOS/Services/Hid/IHidServer.cs @@ -1014,7 +1014,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid context.Request.PtrBuff[1].Position, context.Request.PtrBuff[1].Size); - //Todo: Read all handles and values from buffer. + // TODO: Read all handles and values from buffer. Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, @@ -1137,7 +1137,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid long counter0 = context.RequestData.ReadInt64(); long counter1 = context.RequestData.ReadInt64(); - // Todo: Determine if array is a buffer or not... + // TODO: Determine if array is a buffer or not... Logger.PrintStub(LogClass.ServiceHid, new { appletResourceUserId, counter0, counter1 }); diff --git a/Ryujinx.HLE/HOS/Services/Ldr/IRoInterface.cs b/Ryujinx.HLE/HOS/Services/Ldr/IRoInterface.cs index 202e6df5..49edab59 100644 --- a/Ryujinx.HLE/HOS/Services/Ldr/IRoInterface.cs +++ b/Ryujinx.HLE/HOS/Services/Ldr/IRoInterface.cs @@ -523,7 +523,7 @@ namespace Ryujinx.HLE.HOS.Services.Ldr NrrInfo info; result = ParseNrr(out info, context, nrrAddress, nrrSize); - if(result == 0) + if (result == 0) { if (_nrrInfos.Count >= MaxNrr) { diff --git a/Ryujinx.HLE/HOS/Services/Ns/IAddOnContentManager.cs b/Ryujinx.HLE/HOS/Services/Ns/IAddOnContentManager.cs index 94c0e810..9139c9bf 100644 --- a/Ryujinx.HLE/HOS/Services/Ns/IAddOnContentManager.cs +++ b/Ryujinx.HLE/HOS/Services/Ns/IAddOnContentManager.cs @@ -32,8 +32,8 @@ namespace Ryujinx.HLE.HOS.Services.Ns { Logger.PrintStub(LogClass.ServiceNs); - //TODO: This is supposed to write a u32 array aswell. - //It's unknown what it contains. + // TODO: This is supposed to write a u32 array aswell. + // It's unknown what it contains. context.ResponseData.Write(0); return 0; diff --git a/Ryujinx.HLE/HOS/Services/Ns/IApplicationManagerInterface.cs b/Ryujinx.HLE/HOS/Services/Ns/IApplicationManagerInterface.cs index 88fdb792..8c0fa41a 100644 --- a/Ryujinx.HLE/HOS/Services/Ns/IApplicationManagerInterface.cs +++ b/Ryujinx.HLE/HOS/Services/Ns/IApplicationManagerInterface.cs @@ -1,5 +1,4 @@ using LibHac; -using Ryujinx.Common.Logging; using Ryujinx.HLE.HOS.Ipc; using System; using System.Collections.Generic; diff --git a/Ryujinx.HLE/HOS/Services/Ns/ISystemUpdateInterface.cs b/Ryujinx.HLE/HOS/Services/Ns/ISystemUpdateInterface.cs index 1b898561..5499e235 100644 --- a/Ryujinx.HLE/HOS/Services/Ns/ISystemUpdateInterface.cs +++ b/Ryujinx.HLE/HOS/Services/Ns/ISystemUpdateInterface.cs @@ -13,7 +13,7 @@ namespace Ryujinx.HLE.HOS.Services.Ns { _commands = new Dictionary { - //... + // ... }; } } diff --git a/Ryujinx.HLE/HOS/Services/Ns/IVulnerabilityManagerInterface.cs b/Ryujinx.HLE/HOS/Services/Ns/IVulnerabilityManagerInterface.cs index 922703ec..6b7c4193 100644 --- a/Ryujinx.HLE/HOS/Services/Ns/IVulnerabilityManagerInterface.cs +++ b/Ryujinx.HLE/HOS/Services/Ns/IVulnerabilityManagerInterface.cs @@ -13,7 +13,7 @@ namespace Ryujinx.HLE.HOS.Services.Ns { _commands = new Dictionary { - //... + // ... }; } } diff --git a/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs b/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs index e69cc17f..dcfaef78 100644 --- a/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/INvDrvServices.cs @@ -93,7 +93,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv throw new NotImplementedException($"{fdData.Name} {cmd:x4}"); } - //TODO: Verify if the error codes needs to be translated. + // TODO: Verify if the error codes needs to be translated. context.ResponseData.Write(result); return 0; @@ -127,7 +127,7 @@ namespace Ryujinx.HLE.HOS.Services.Nv int fd = context.RequestData.ReadInt32(); int eventId = context.RequestData.ReadInt32(); - //TODO: Use Fd/EventId, different channels have different events. + // TODO: Use Fd/EventId, different channels have different events. if (context.Process.HandleTable.GenerateHandle(_event.ReadableEvent, out int handle) != KernelResult.Success) { throw new InvalidOperationException("Out of handles!"); diff --git a/Ryujinx.HLE/HOS/Services/Nv/NvGpuAS/NvGpuASCtx.cs b/Ryujinx.HLE/HOS/Services/Nv/NvGpuAS/NvGpuASCtx.cs index 67b80e33..e3cdf2f8 100644 --- a/Ryujinx.HLE/HOS/Services/Nv/NvGpuAS/NvGpuASCtx.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvGpuAS/NvGpuASCtx.cs @@ -50,25 +50,25 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuAS { long mapEnd = position + size; - //Check if size is valid (0 is also not allowed). + // Check if size is valid (0 is also not allowed). if ((ulong)mapEnd <= (ulong)position) { return false; } - //Check if address is page aligned. + // Check if address is page aligned. if ((position & NvGpuVmm.PageMask) != 0) { return false; } - //Check if region is reserved. + // Check if region is reserved. if (BinarySearch(_reservations, position) == null) { return false; } - //Check for overlap with already mapped buffers. + // Check for overlap with already mapped buffers. Range map = BinarySearchLt(_maps, mapEnd); if (map != null && map.End > (ulong)position) diff --git a/Ryujinx.HLE/HOS/Services/Nv/NvGpuAS/NvGpuASIoctl.cs b/Ryujinx.HLE/HOS/Services/Nv/NvGpuAS/NvGpuASIoctl.cs index 57728382..3b96ed6b 100644 --- a/Ryujinx.HLE/HOS/Services/Nv/NvGpuAS/NvGpuASIoctl.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvGpuAS/NvGpuASIoctl.cs @@ -64,8 +64,8 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuAS lock (asCtx) { - //Note: When the fixed offset flag is not set, - //the Offset field holds the alignment size instead. + // Note: When the fixed offset flag is not set, + // the Offset field holds the alignment size instead. if ((args.Flags & FlagFixedOffset) != 0) { args.Offset = asCtx.Vmm.ReserveFixed(args.Offset, (long)size); @@ -218,8 +218,8 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvGpuAS lock (asCtx) { - //Note: When the fixed offset flag is not set, - //the Offset field holds the alignment size instead. + // Note: When the fixed offset flag is not set, + // the Offset field holds the alignment size instead. bool vaAllocated = (args.Flags & FlagFixedOffset) == 0; if (!vaAllocated) diff --git a/Ryujinx.HLE/HOS/Services/Nv/NvHostChannel/NvHostChannelIoctl.cs b/Ryujinx.HLE/HOS/Services/Nv/NvHostChannel/NvHostChannelIoctl.cs index a13f0fcb..c5f29636 100644 --- a/Ryujinx.HLE/HOS/Services/Nv/NvHostChannel/NvHostChannelIoctl.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvHostChannel/NvHostChannelIoctl.cs @@ -69,14 +69,14 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostChannel context.Device.Gpu.PushCommandBuffer(vmm, cmdBufData); } - //TODO: Relocation, waitchecks, etc. + // TODO: Relocation, waitchecks, etc. return NvResult.Success; } private static int GetSyncpoint(ServiceCtx context) { - //TODO + // TODO long inputPosition = context.Request.GetBufferType0x21().Position; long outputPosition = context.Request.GetBufferType0x22().Position; diff --git a/Ryujinx.HLE/HOS/Services/Nv/NvHostCtrl/NvHostCtrlIoctl.cs b/Ryujinx.HLE/HOS/Services/Nv/NvHostCtrl/NvHostCtrlIoctl.cs index e05ea77c..35f1a949 100644 --- a/Ryujinx.HLE/HOS/Services/Nv/NvHostCtrl/NvHostCtrlIoctl.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvHostCtrl/NvHostCtrlIoctl.cs @@ -208,8 +208,8 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvHostCtrl { syncpt.AddWaiter(args.Thresh, waitEvent); - //Note: Negative (> INT_MAX) timeouts aren't valid on .NET, - //in this case we just use the maximum timeout possible. + // Note: Negative (> INT_MAX) timeouts aren't valid on .NET, + // in this case we just use the maximum timeout possible. int timeout = args.Timeout; if (timeout < -1) diff --git a/Ryujinx.HLE/HOS/Services/Nv/NvMap/NvMapIoctl.cs b/Ryujinx.HLE/HOS/Services/Nv/NvMap/NvMapIoctl.cs index b1ae8307..72286662 100644 --- a/Ryujinx.HLE/HOS/Services/Nv/NvMap/NvMapIoctl.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvMap/NvMapIoctl.cs @@ -128,9 +128,9 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvMap if (address == 0) { - //When the address is zero, we need to allocate - //our own backing memory for the NvMap. - //TODO: Is this allocation inside the transfer memory? + // When the address is zero, we need to allocate + // our own backing memory for the NvMap. + // TODO: Is this allocation inside the transfer memory? result = NvResult.OutOfMemory; } @@ -208,8 +208,8 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvMap case NvMapHandleParam.Kind: args.Result = map.Kind; break; case NvMapHandleParam.Compr: args.Result = 0; break; - //Note: Base is not supported and returns an error. - //Any other value also returns an error. + // Note: Base is not supported and returns an error. + // Any other value also returns an error. default: return NvResult.InvalidInput; } diff --git a/Ryujinx.HLE/HOS/Services/Pctl/IParentalControlService.cs b/Ryujinx.HLE/HOS/Services/Pctl/IParentalControlService.cs index 3e8ae81c..2a4a3bdd 100644 --- a/Ryujinx.HLE/HOS/Services/Pctl/IParentalControlService.cs +++ b/Ryujinx.HLE/HOS/Services/Pctl/IParentalControlService.cs @@ -1,6 +1,5 @@ using Ryujinx.Common.Logging; using Ryujinx.HLE.HOS.Ipc; -using System; using System.Collections.Generic; namespace Ryujinx.HLE.HOS.Services.Pctl diff --git a/Ryujinx.HLE/HOS/Services/Pl/ISharedFontManager.cs b/Ryujinx.HLE/HOS/Services/Pl/ISharedFontManager.cs index 1bdff31a..1c67d356 100644 --- a/Ryujinx.HLE/HOS/Services/Pl/ISharedFontManager.cs +++ b/Ryujinx.HLE/HOS/Services/Pl/ISharedFontManager.cs @@ -29,8 +29,8 @@ namespace Ryujinx.HLE.HOS.Services.Pl { SharedFontType fontType = (SharedFontType)context.RequestData.ReadInt32(); - //We don't need to do anything here because we do lazy initialization - //on SharedFontManager (the font is loaded when necessary). + // We don't need to do anything here because we do lazy initialization + // on SharedFontManager (the font is loaded when necessary). return 0; } @@ -38,8 +38,8 @@ namespace Ryujinx.HLE.HOS.Services.Pl { SharedFontType fontType = (SharedFontType)context.RequestData.ReadInt32(); - //1 (true) indicates that the font is already loaded. - //All fonts are already loaded. + // 1 (true) indicates that the font is already loaded. + // All fonts are already loaded. context.ResponseData.Write(1); return 0; diff --git a/Ryujinx.HLE/HOS/Services/Pm/IShellInterface.cs b/Ryujinx.HLE/HOS/Services/Pm/IShellInterface.cs index 8880b334..35fdd547 100644 --- a/Ryujinx.HLE/HOS/Services/Pm/IShellInterface.cs +++ b/Ryujinx.HLE/HOS/Services/Pm/IShellInterface.cs @@ -1,7 +1,5 @@ using Ryujinx.HLE.HOS.Ipc; -using System; using System.Collections.Generic; -using System.Text; namespace Ryujinx.HLE.HOS.Services.Pm { diff --git a/Ryujinx.HLE/HOS/Services/Set/ISystemSettingsServer.cs b/Ryujinx.HLE/HOS/Services/Set/ISystemSettingsServer.cs index 4a67638b..fd8ffe5e 100644 --- a/Ryujinx.HLE/HOS/Services/Set/ISystemSettingsServer.cs +++ b/Ryujinx.HLE/HOS/Services/Set/ISystemSettingsServer.cs @@ -62,7 +62,7 @@ namespace Ryujinx.HLE.HOS.Services.Set const string version = "3.0.0"; const string build = "NintendoSDK Firmware for NX 3.0.0-10.0"; - //http://switchbrew.org/index.php?title=System_Version_Title + // http://switchbrew.org/index.php?title=System_Version_Title using (MemoryStream ms = new MemoryStream(0x100)) { BinaryWriter writer = new BinaryWriter(ms); @@ -177,7 +177,7 @@ namespace Ryujinx.HLE.HOS.Services.Set long titleId = 0x0100000000000809; string contentPath = device.System.ContentManager.GetInstalledContentPath(titleId, StorageId.NandSystem, ContentType.Data); - if(string.IsNullOrWhiteSpace(contentPath)) + if (string.IsNullOrWhiteSpace(contentPath)) { return null; } diff --git a/Ryujinx.HLE/HOS/Services/Set/NxSettings.cs b/Ryujinx.HLE/HOS/Services/Set/NxSettings.cs index 70ab55f9..b47a5390 100644 --- a/Ryujinx.HLE/HOS/Services/Set/NxSettings.cs +++ b/Ryujinx.HLE/HOS/Services/Set/NxSettings.cs @@ -4,7 +4,7 @@ namespace Ryujinx.HLE.HOS.Services.Set { static class NxSettings { - //Generated automatically from a Switch 3.0 config file (Tid: 0100000000000818). + // Generated automatically from a Switch 3.0 config file (Tid: 0100000000000818). public static Dictionary Settings = new Dictionary { { "account!na_required_for_network_service", true }, diff --git a/Ryujinx.HLE/HOS/Services/Ssl/ISslContext.cs b/Ryujinx.HLE/HOS/Services/Ssl/ISslContext.cs index cf58ed87..1910998f 100644 --- a/Ryujinx.HLE/HOS/Services/Ssl/ISslContext.cs +++ b/Ryujinx.HLE/HOS/Services/Ssl/ISslContext.cs @@ -13,7 +13,7 @@ namespace Ryujinx.HLE.HOS.Services.Ssl { _commands = new Dictionary { - //... + // ... }; } } diff --git a/Ryujinx.HLE/HOS/Services/Vi/ColorFormat.cs b/Ryujinx.HLE/HOS/Services/Vi/ColorFormat.cs index 67848b43..70938585 100644 --- a/Ryujinx.HLE/HOS/Services/Vi/ColorFormat.cs +++ b/Ryujinx.HLE/HOS/Services/Vi/ColorFormat.cs @@ -1,4 +1,5 @@ -namespace Ryujinx.HLE.HOS.Services.Android +// ReSharper disable InconsistentNaming +namespace Ryujinx.HLE.HOS.Services.Android { class ColorShift { diff --git a/Ryujinx.HLE/HOS/Services/Vi/GbpBuffer.cs b/Ryujinx.HLE/HOS/Services/Vi/GbpBuffer.cs index eb1adc77..75b543b8 100644 --- a/Ryujinx.HLE/HOS/Services/Vi/GbpBuffer.cs +++ b/Ryujinx.HLE/HOS/Services/Vi/GbpBuffer.cs @@ -150,7 +150,7 @@ namespace Ryujinx.HLE.HOS.Services.Android if (Header.IntsCount != 0x51) { - throw new System.NotImplementedException($"Unexpected Graphic Buffer ints count (expected 0x51, found 0x{Header.IntsCount:x}"); + throw new NotImplementedException($"Unexpected Graphic Buffer ints count (expected 0x51, found 0x{Header.IntsCount:x}"); } Buffer = reader.ReadStruct(); diff --git a/Ryujinx.HLE/HOS/Services/Vi/IApplicationDisplayService.cs b/Ryujinx.HLE/HOS/Services/Vi/IApplicationDisplayService.cs index 686f85ef..be9fc263 100644 --- a/Ryujinx.HLE/HOS/Services/Vi/IApplicationDisplayService.cs +++ b/Ryujinx.HLE/HOS/Services/Vi/IApplicationDisplayService.cs @@ -81,7 +81,7 @@ namespace Ryujinx.HLE.HOS.Services.Vi MemoryHelper.FillWithZeros(context.Memory, recBuffPtr, 0x60); - //Add only the default display to buffer + // Add only the default display to buffer context.Memory.WriteBytes(recBuffPtr, Encoding.ASCII.GetBytes("Default")); context.Memory.WriteInt64(recBuffPtr + 0x40, 0x1L); context.Memory.WriteInt64(recBuffPtr + 0x48, 0x1L); @@ -186,14 +186,14 @@ namespace Ryujinx.HLE.HOS.Services.Vi if (!convertedScalingMode.HasValue) { - //Scaling mode out of the range of valid values. + // Scaling mode out of the range of valid values. return MakeError(ErrorModule.Vi, 1); } if (scalingMode != SrcScalingMode.ScaleToWindow && scalingMode != SrcScalingMode.PreserveAspectRatio) { - //Invalid scaling mode specified. + // Invalid scaling mode specified. return MakeError(ErrorModule.Vi, 6); } @@ -239,7 +239,7 @@ namespace Ryujinx.HLE.HOS.Services.Vi { BinaryWriter writer = new BinaryWriter(ms); - //flat_binder_object (size is 0x28) + // flat_binder_object (size is 0x28) writer.Write(2); //Type (BINDER_TYPE_WEAK_BINDER) writer.Write(0); //Flags writer.Write((int)(id >> 0)); diff --git a/Ryujinx.HLE/HOS/Services/Vi/ISystemDisplayService.cs b/Ryujinx.HLE/HOS/Services/Vi/ISystemDisplayService.cs index 6d001588..076618d7 100644 --- a/Ryujinx.HLE/HOS/Services/Vi/ISystemDisplayService.cs +++ b/Ryujinx.HLE/HOS/Services/Vi/ISystemDisplayService.cs @@ -37,7 +37,7 @@ namespace Ryujinx.HLE.HOS.Services.Vi public static long GetDisplayMode(ServiceCtx context) { - //TODO: De-hardcode resolution. + // TODO: De-hardcode resolution. context.ResponseData.Write(1280); context.ResponseData.Write(720); context.ResponseData.Write(60.0f); diff --git a/Ryujinx.HLE/HOS/Services/Vi/NvFlinger.cs b/Ryujinx.HLE/HOS/Services/Vi/NvFlinger.cs index 66c33279..d6b5fbdb 100644 --- a/Ryujinx.HLE/HOS/Services/Vi/NvFlinger.cs +++ b/Ryujinx.HLE/HOS/Services/Vi/NvFlinger.cs @@ -1,7 +1,6 @@ using Ryujinx.Common.Logging; using Ryujinx.Graphics.Gal; using Ryujinx.Graphics.Memory; -using Ryujinx.HLE.HOS.Kernel; using Ryujinx.HLE.HOS.Kernel.Threading; using Ryujinx.HLE.HOS.Services.Nv.NvGpuAS; using Ryujinx.HLE.HOS.Services.Nv.NvMap; @@ -213,7 +212,7 @@ namespace Ryujinx.HLE.HOS.Services.Android private long GbpDequeueBuffer(ServiceCtx context, BinaryReader parcelReader) { - //TODO: Errors. + // TODO: Errors. int format = parcelReader.ReadInt32(); int width = parcelReader.ReadInt32(); int height = parcelReader.ReadInt32(); @@ -229,7 +228,7 @@ namespace Ryujinx.HLE.HOS.Services.Android { context.Device.Statistics.RecordGameFrameTime(); - //TODO: Errors. + // TODO: Errors. int slot = parcelReader.ReadInt32(); long Position = parcelReader.BaseStream.Position; @@ -260,7 +259,7 @@ namespace Ryujinx.HLE.HOS.Services.Android private long GbpCancelBuffer(ServiceCtx context, BinaryReader parcelReader) { - //TODO: Errors. + // TODO: Errors. int slot = parcelReader.ReadInt32(); MultiFence fence = ReadFlattenedObject(parcelReader); @@ -401,7 +400,7 @@ namespace Ryujinx.HLE.HOS.Services.Android int BlockHeight = 1 << _bufferQueue[slot].Data.Buffer.Surfaces[0].BlockHeightLog2; - //Note: Rotation is being ignored. + // Note: Rotation is being ignored. int top = crop.Top; int left = crop.Left; diff --git a/Ryujinx.HLE/HOS/SystemState/SystemStateMgr.cs b/Ryujinx.HLE/HOS/SystemState/SystemStateMgr.cs index 2f0c35f4..36775b07 100644 --- a/Ryujinx.HLE/HOS/SystemState/SystemStateMgr.cs +++ b/Ryujinx.HLE/HOS/SystemState/SystemStateMgr.cs @@ -40,7 +40,7 @@ namespace Ryujinx.HLE.HOS.SystemState internal string ActiveAudioOutput { get; private set; } - public bool DiscordIntergrationEnabled { get; set; } + public bool DiscordIntegrationEnabled { get; set; } public bool DockedMode { get; set; } diff --git a/Ryujinx.HLE/Input/Hid.cs b/Ryujinx.HLE/Input/Hid.cs index 83c4ddea..c42f3b6c 100644 --- a/Ryujinx.HLE/Input/Hid.cs +++ b/Ryujinx.HLE/Input/Hid.cs @@ -19,7 +19,7 @@ namespace Ryujinx.HLE.Input device.Memory.FillWithZeros(hidPosition, Horizon.HidSize); } - public void InitilizePrimaryController(HidControllerType controllerType) + public void InitializePrimaryController(HidControllerType controllerType) { HidControllerId controllerId = controllerType == HidControllerType.Handheld ? HidControllerId.ControllerHandheld : HidControllerId.ControllerPlayer1; @@ -39,7 +39,7 @@ namespace Ryujinx.HLE.Input PrimaryController.Connect(controllerId); } - public void InitilizeKeyboard() + public void InitializeKeyboard() { _device.Memory.FillWithZeros(HidPosition + HidKeyboardOffset, HidKeyboardSize); } diff --git a/Ryujinx.HLE/Input/HidNpadController.cs b/Ryujinx.HLE/Input/HidNpadController.cs index 45dee3ca..0c773e86 100644 --- a/Ryujinx.HLE/Input/HidNpadController.cs +++ b/Ryujinx.HLE/Input/HidNpadController.cs @@ -36,7 +36,7 @@ public override void Connect(HidControllerId controllerId) { - if(HidControllerType != HidControllerType.NpadLeft && HidControllerType != HidControllerType.NpadRight) + if (HidControllerType != HidControllerType.NpadLeft && HidControllerType != HidControllerType.NpadRight) { _isHalf = false; } diff --git a/Ryujinx.HLE/Loaders/Compression/Lz4.cs b/Ryujinx.HLE/Loaders/Compression/Lz4.cs index e405b107..2001a8dc 100644 --- a/Ryujinx.HLE/Loaders/Compression/Lz4.cs +++ b/Ryujinx.HLE/Loaders/Compression/Lz4.cs @@ -34,7 +34,7 @@ namespace Ryujinx.HLE.Loaders.Compression int encCount = (token >> 0) & 0xf; int litCount = (token >> 4) & 0xf; - //Copy literal chunck + // Copy literal chunk litCount = GetLength(litCount); Buffer.BlockCopy(cmp, cmpPos, dec, decPos, litCount); @@ -47,7 +47,7 @@ namespace Ryujinx.HLE.Loaders.Compression break; } - //Copy compressed chunck + // Copy compressed chunk int back = cmp[cmpPos++] << 0 | cmp[cmpPos++] << 8; diff --git a/Ryujinx.HLE/Loaders/Executables/NxStaticObject.cs b/Ryujinx.HLE/Loaders/Executables/NxStaticObject.cs index c35a8f1a..03c3b39a 100644 --- a/Ryujinx.HLE/Loaders/Executables/NxStaticObject.cs +++ b/Ryujinx.HLE/Loaders/Executables/NxStaticObject.cs @@ -75,7 +75,7 @@ namespace Ryujinx.HLE.Loaders.Executables DataOffset = dataMemOffset; BssSize = bssSize; - //Text segment + // Text segment input.Seek(textOffset, SeekOrigin.Begin); Text = reader.ReadBytes(textSize); @@ -85,7 +85,7 @@ namespace Ryujinx.HLE.Loaders.Executables Text = Lz4.Decompress(Text, textDecSize); } - //Read-only data segment + // Read-only data segment input.Seek(roOffset, SeekOrigin.Begin); Ro = reader.ReadBytes(roSize); @@ -95,7 +95,7 @@ namespace Ryujinx.HLE.Loaders.Executables Ro = Lz4.Decompress(Ro, roDecSize); } - //Data segment + // Data segment input.Seek(dataOffset, SeekOrigin.Begin); Data = reader.ReadBytes(dataSize); diff --git a/Ryujinx.HLE/Loaders/Npdm/ACI0.cs b/Ryujinx.HLE/Loaders/Npdm/ACI0.cs index 55f3319d..af426bcf 100644 --- a/Ryujinx.HLE/Loaders/Npdm/ACI0.cs +++ b/Ryujinx.HLE/Loaders/Npdm/ACI0.cs @@ -30,7 +30,7 @@ namespace Ryujinx.HLE.Loaders.Npdm TitleId = reader.ReadInt64(); - //Reserved. + // Reserved. stream.Seek(8, SeekOrigin.Current); int fsAccessHeaderOffset = reader.ReadInt32(); diff --git a/Ryujinx.HLE/Loaders/Npdm/ACID.cs b/Ryujinx.HLE/Loaders/Npdm/ACID.cs index 57c5cf3e..4a181b29 100644 --- a/Ryujinx.HLE/Loaders/Npdm/ACID.cs +++ b/Ryujinx.HLE/Loaders/Npdm/ACID.cs @@ -33,12 +33,12 @@ namespace Ryujinx.HLE.Loaders.Npdm throw new InvalidNpdmException("ACID Stream doesn't contain ACID section!"); } - //Size field used with the above signature (?). + // Size field used with the above signature (?). Unknown1 = reader.ReadInt32(); reader.ReadInt32(); - //Bit0 must be 1 on retail, on devunit 0 is also allowed. Bit1 is unknown. + // Bit0 must be 1 on retail, on devunit 0 is also allowed. Bit1 is unknown. Flags = reader.ReadInt32(); TitleIdRangeMin = reader.ReadInt64(); diff --git a/Ryujinx.HLE/Loaders/Npdm/Npdm.cs b/Ryujinx.HLE/Loaders/Npdm/Npdm.cs index cef2673e..36449e40 100644 --- a/Ryujinx.HLE/Loaders/Npdm/Npdm.cs +++ b/Ryujinx.HLE/Loaders/Npdm/Npdm.cs @@ -4,9 +4,9 @@ using System.Text; namespace Ryujinx.HLE.Loaders.Npdm { - //https://github.com/SciresM/hactool/blob/master/npdm.c - //https://github.com/SciresM/hactool/blob/master/npdm.h - //http://switchbrew.org/index.php?title=NPDM + // https://github.com/SciresM/hactool/blob/master/npdm.c + // https://github.com/SciresM/hactool/blob/master/npdm.h + // http://switchbrew.org/index.php?title=NPDM class Npdm { private const int MetaMagic = 'M' << 0 | 'E' << 8 | 'T' << 16 | 'A' << 24; diff --git a/Ryujinx.HLE/Loaders/Npdm/ServiceAccessControl.cs b/Ryujinx.HLE/Loaders/Npdm/ServiceAccessControl.cs index def780a2..03f62ff7 100644 --- a/Ryujinx.HLE/Loaders/Npdm/ServiceAccessControl.cs +++ b/Ryujinx.HLE/Loaders/Npdm/ServiceAccessControl.cs @@ -15,11 +15,11 @@ namespace Ryujinx.HLE.Loaders.Npdm BinaryReader reader = new BinaryReader(stream); - int byteReaded = 0; + int bytesRead = 0; Dictionary services = new Dictionary(); - while (byteReaded != size) + while (bytesRead != size) { byte controlByte = reader.ReadByte(); @@ -33,7 +33,7 @@ namespace Ryujinx.HLE.Loaders.Npdm services[Encoding.ASCII.GetString(reader.ReadBytes(length))] = registerAllowed; - byteReaded += length + 1; + bytesRead += length + 1; } Services = new ReadOnlyDictionary(services); diff --git a/Ryujinx.HLE/Utilities/StringUtils.cs b/Ryujinx.HLE/Utilities/StringUtils.cs index 055b8339..ad18192e 100644 --- a/Ryujinx.HLE/Utilities/StringUtils.cs +++ b/Ryujinx.HLE/Utilities/StringUtils.cs @@ -37,7 +37,7 @@ namespace Ryujinx.HLE.Utilities public static byte[] HexToBytes(string hexString) { - //Ignore last charactor if HexLength % 2 != 0. + // Ignore last character if HexLength % 2 != 0. int bytesInHex = hexString.Length / 2; byte[] output = new byte[bytesInHex]; diff --git a/Ryujinx.Profiler/InternalProfile.cs b/Ryujinx.Profiler/InternalProfile.cs index bd522b00..46984601 100644 --- a/Ryujinx.Profiler/InternalProfile.cs +++ b/Ryujinx.Profiler/InternalProfile.cs @@ -80,7 +80,7 @@ namespace Ryujinx.Profiler Monitor.Exit(_timerQueueClearLock); } - // Only sleep if queue was sucessfully cleared + // Only sleep if queue was successfully cleared if (queueCleared) { Thread.Sleep(5); @@ -92,9 +92,9 @@ namespace Ryujinx.Profiler { int count = 0; - while (_timerQueue.TryDequeue(out var item)) + while (_timerQueue.TryDequeue(out TimerQueueValue item)) { - if (!Timers.TryGetValue(item.Config, out var value)) + if (!Timers.TryGetValue(item.Config, out TimingInfo value)) { value = new TimingInfo(); Timers.Add(item.Config, value); @@ -206,9 +206,9 @@ namespace Ryujinx.Profiler return (_timingFlagAverages, _timingFlagLastDelta); } - public void RegisterFlagReciever(Action reciever) + public void RegisterFlagReceiver(Action receiver) { - _timingFlagCallback = reciever; + _timingFlagCallback = receiver; } public void Dispose() diff --git a/Ryujinx.Profiler/Profile.cs b/Ryujinx.Profiler/Profile.cs index 7af73a52..4dba6ea5 100644 --- a/Ryujinx.Profiler/Profile.cs +++ b/Ryujinx.Profiler/Profile.cs @@ -17,7 +17,7 @@ namespace Ryujinx.Profiler private static ProfilerSettings _settings; [Conditional("USE_PROFILING")] - public static void Initalize() + public static void Initialize() { var config = ProfilerConfiguration.Load(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ProfilerConfig.jsonc")); @@ -70,11 +70,11 @@ namespace Ryujinx.Profiler } [Conditional("USE_PROFILING")] - public static void RegisterFlagReciever(Action reciever) + public static void RegisterFlagReceiver(Action receiver) { if (!ProfilingEnabled()) return; - _profileInstance.RegisterFlagReciever(reciever); + _profileInstance.RegisterFlagReceiver(receiver); } [Conditional("USE_PROFILING")] diff --git a/Ryujinx.Profiler/ProfilerConfiguration.cs b/Ryujinx.Profiler/ProfilerConfiguration.cs index b4d629e4..4fe616fa 100644 --- a/Ryujinx.Profiler/ProfilerConfiguration.cs +++ b/Ryujinx.Profiler/ProfilerConfiguration.cs @@ -1,9 +1,6 @@ using OpenTK.Input; using System; -using System.Collections.Generic; using System.IO; -using System.Text; -using System.Threading.Tasks; using Utf8Json; using Utf8Json.Resolvers; @@ -58,7 +55,7 @@ namespace Ryujinx.Profiler return default(T); } - var enumName = formatterResolver.GetFormatterWithVerify() + string enumName = formatterResolver.GetFormatterWithVerify() .Deserialize(ref reader, formatterResolver); if (Enum.TryParse(enumName, out T result)) diff --git a/Ryujinx.Profiler/ProfilerKeyboardHandler.cs b/Ryujinx.Profiler/ProfilerKeyboardHandler.cs index e1075c8d..e6207e89 100644 --- a/Ryujinx.Profiler/ProfilerKeyboardHandler.cs +++ b/Ryujinx.Profiler/ProfilerKeyboardHandler.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using OpenTK.Input; +using OpenTK.Input; namespace Ryujinx.Profiler { diff --git a/Ryujinx.Profiler/Settings.cs b/Ryujinx.Profiler/Settings.cs index c0393545..f0c851b2 100644 --- a/Ryujinx.Profiler/Settings.cs +++ b/Ryujinx.Profiler/Settings.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Ryujinx.Profiler +namespace Ryujinx.Profiler { public class ProfilerSettings { diff --git a/Ryujinx.Profiler/TimingFlag.cs b/Ryujinx.Profiler/TimingFlag.cs index 7d7c715f..0cf55bdf 100644 --- a/Ryujinx.Profiler/TimingFlag.cs +++ b/Ryujinx.Profiler/TimingFlag.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Text; - -namespace Ryujinx.Profiler +namespace Ryujinx.Profiler { public enum TimingFlagType { diff --git a/Ryujinx.Profiler/TimingInfo.cs b/Ryujinx.Profiler/TimingInfo.cs index e444e423..6058ddbd 100644 --- a/Ryujinx.Profiler/TimingInfo.cs +++ b/Ryujinx.Profiler/TimingInfo.cs @@ -107,7 +107,7 @@ namespace Ryujinx.Profiler _timestamps.Add(_currentTimestamp); } - var delta = _currentTimestamp.EndTime - _currentTimestamp.BeginTime; + long delta = _currentTimestamp.EndTime - _currentTimestamp.BeginTime; TotalTime += delta; Instant += delta; diff --git a/Ryujinx.Profiler/UI/ProfileSorters.cs b/Ryujinx.Profiler/UI/ProfileSorters.cs index 2d06f426..9f66de22 100644 --- a/Ryujinx.Profiler/UI/ProfileSorters.cs +++ b/Ryujinx.Profiler/UI/ProfileSorters.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Text; namespace Ryujinx.Profiler.UI { diff --git a/Ryujinx.Profiler/UI/ProfileWindow.cs b/Ryujinx.Profiler/UI/ProfileWindow.cs index c58b9235..1db70bc7 100644 --- a/Ryujinx.Profiler/UI/ProfileWindow.cs +++ b/Ryujinx.Profiler/UI/ProfileWindow.cs @@ -98,7 +98,7 @@ namespace Ryujinx.Profiler.UI private readonly object _profileDataLock = new object(); public ProfileWindow() - // Graphigs mode enables 2xAA + // Graphics mode enables 2xAA : base(1280, 720, new GraphicsMode(new ColorFormat(8, 8, 8, 8), 1, 1, 2)) { Title = "Profiler"; @@ -108,7 +108,7 @@ namespace Ryujinx.Profiler.UI if (Profile.UpdateRate <= 0) { // Perform step regardless of flag type - Profile.RegisterFlagReciever((t) => + Profile.RegisterFlagReceiver((t) => { if (!_paused) { @@ -146,7 +146,7 @@ namespace Ryujinx.Profiler.UI { GL.ClearColor(Color.Black); _fontService = new FontService(); - _fontService.InitalizeTextures(); + _fontService.InitializeTextures(); _fontService.UpdateScreenHeight(Height); _buttons = new ProfileButton[(int)ButtonIndex.Count]; diff --git a/Ryujinx.Profiler/UI/ProfileWindowBars.cs b/Ryujinx.Profiler/UI/ProfileWindowBars.cs index b1955a07..ab5b4fd1 100644 --- a/Ryujinx.Profiler/UI/ProfileWindowBars.cs +++ b/Ryujinx.Profiler/UI/ProfileWindowBars.cs @@ -18,7 +18,7 @@ namespace Ryujinx.Profiler.UI float barHeight = (LineHeight - LinePadding) / 3.0f; // Get max values - var maxInstant = maxAverage = maxTotal = 0; + long maxInstant = maxAverage = maxTotal = 0; foreach (KeyValuePair kvp in _sortedProfileData) { maxInstant = Math.Max(maxInstant, kvp.Value.Instant); diff --git a/Ryujinx.Profiler/UI/ProfileWindowGraph.cs b/Ryujinx.Profiler/UI/ProfileWindowGraph.cs index 9d34be97..6a4a52a9 100644 --- a/Ryujinx.Profiler/UI/ProfileWindowGraph.cs +++ b/Ryujinx.Profiler/UI/ProfileWindowGraph.cs @@ -7,8 +7,8 @@ namespace Ryujinx.Profiler.UI { public partial class ProfileWindow { - // Colour index equal to timing flag type as int - private Color[] _timingFlagColours = new[] + // Color index equal to timing flag type as int + private Color[] _timingFlagColors = new[] { new Color(150, 25, 25, 50), // FrameSwap = 0 new Color(25, 25, 150, 50), // SystemFrame = 1 @@ -62,7 +62,7 @@ namespace Ryujinx.Profiler.UI if (prevType != timingFlag.FlagType) { prevType = timingFlag.FlagType; - GL.Color4(_timingFlagColours[(int)prevType]); + GL.Color4(_timingFlagColors[(int)prevType]); } int x = (int)(graphRight - ((graphPositionTicks - timingFlag.Timestamp) / timeWidthTicks) * width); diff --git a/Ryujinx.Profiler/UI/ProfileWindowManager.cs b/Ryujinx.Profiler/UI/ProfileWindowManager.cs index 4ba0c881..c6a65a31 100644 --- a/Ryujinx.Profiler/UI/ProfileWindowManager.cs +++ b/Ryujinx.Profiler/UI/ProfileWindowManager.cs @@ -1,5 +1,4 @@ -using System.Diagnostics; -using System.Threading; +using System.Threading; using OpenTK; using OpenTK.Input; using Ryujinx.Common; diff --git a/Ryujinx.Profiler/UI/SharpFontHelpers/FontService.cs b/Ryujinx.Profiler/UI/SharpFontHelpers/FontService.cs index e64c9da3..32846977 100644 --- a/Ryujinx.Profiler/UI/SharpFontHelpers/FontService.cs +++ b/Ryujinx.Profiler/UI/SharpFontHelpers/FontService.cs @@ -36,7 +36,7 @@ namespace Ryujinx.Profiler.UI.SharpFontHelpers private string GetFontPath() { - string fontFolder = System.Environment.GetFolderPath(Environment.SpecialFolder.Fonts); + string fontFolder = Environment.GetFolderPath(Environment.SpecialFolder.Fonts); // Only uses Arial, add more fonts here if wanted string path = Path.Combine(fontFolder, "arial.ttf"); @@ -48,7 +48,7 @@ namespace Ryujinx.Profiler.UI.SharpFontHelpers throw new Exception($"Profiler exception. Required font Courier New or Arial not installed to {fontFolder}"); } - public void InitalizeTextures() + public void InitializeTextures() { // Create and init some vars uint[] rawCharacterSheet = new uint[SheetWidth * SheetHeight]; @@ -66,7 +66,7 @@ namespace Ryujinx.Profiler.UI.SharpFontHelpers // Update raw data for each character for (int i = 0; i < 94; i++) { - var surface = RenderSurface((char)(i + 33), font, out var xBearing, out var yBearing, out var advance); + var surface = RenderSurface((char)(i + 33), font, out float xBearing, out float yBearing, out float advance); characters[i] = UpdateTexture(surface, ref rawCharacterSheet, ref x, ref y, ref lineOffset); characters[i].BearingX = xBearing; @@ -217,7 +217,7 @@ namespace Ryujinx.Profiler.UI.SharpFontHelpers lineOffset = 0; } - // Update lineoffset + // Update lineOffset if (lineOffset < height) { lineOffset = height + 1; diff --git a/Ryujinx.Tests.Unicorn/IndexedProperty.cs b/Ryujinx.Tests.Unicorn/IndexedProperty.cs index 946620c6..a4365026 100644 --- a/Ryujinx.Tests.Unicorn/IndexedProperty.cs +++ b/Ryujinx.Tests.Unicorn/IndexedProperty.cs @@ -9,8 +9,8 @@ namespace Ryujinx.Tests.Unicorn public IndexedProperty(Func getFunc, Action setAction) { - this.GetFunc = getFunc; - this.SetAction = setAction; + GetFunc = getFunc; + SetAction = setAction; } public TValue this[TIndex i] diff --git a/Ryujinx.Tests.Unicorn/Native/ArmRegister.cs b/Ryujinx.Tests.Unicorn/Native/ArmRegister.cs index cf110598..af331bd1 100644 --- a/Ryujinx.Tests.Unicorn/Native/ArmRegister.cs +++ b/Ryujinx.Tests.Unicorn/Native/ArmRegister.cs @@ -1,3 +1,4 @@ +// ReSharper disable InconsistentNaming namespace Ryujinx.Tests.Unicorn.Native { public enum ArmRegister @@ -265,26 +266,26 @@ namespace Ryujinx.Tests.Unicorn.Native V30, V31, - //> pseudo registers + // > pseudo registers PC, // program counter register CPACR_EL1, ESR, - //> thread registers + // > thread registers TPIDR_EL0, TPIDRRO_EL0, TPIDR_EL1, PSTATE, // PSTATE pseudoregister - //> floating point control and status registers + // > floating point control and status registers FPCR, FPSR, ENDING, // <-- mark the end of the list of registers - //> alias registers + // > alias registers IP0 = X16, IP1 = X17, diff --git a/Ryujinx.Tests.Unicorn/Native/Interface.cs b/Ryujinx.Tests.Unicorn/Native/Interface.cs index b2786d14..006585b5 100644 --- a/Ryujinx.Tests.Unicorn/Native/Interface.cs +++ b/Ryujinx.Tests.Unicorn/Native/Interface.cs @@ -15,7 +15,7 @@ namespace Ryujinx.Tests.Unicorn.Native public static void MarshalArrayOf(IntPtr input, int length, out T[] output) { - var size = Marshal.SizeOf(typeof(T)); + int size = Marshal.SizeOf(typeof(T)); output = new T[length]; for (int i = 0; i < length; i++) @@ -23,7 +23,7 @@ namespace Ryujinx.Tests.Unicorn.Native IntPtr item = new IntPtr(input.ToInt64() + i * size); output[i] = Marshal.PtrToStructure(item); } - } + } [DllImport("unicorn", CallingConvention = CallingConvention.Cdecl)] public static extern uint uc_version(out uint major, out uint minor); diff --git a/Ryujinx.Tests.Unicorn/Native/UnicornMode.cs b/Ryujinx.Tests.Unicorn/Native/UnicornMode.cs index a5040518..5cd83516 100644 --- a/Ryujinx.Tests.Unicorn/Native/UnicornMode.cs +++ b/Ryujinx.Tests.Unicorn/Native/UnicornMode.cs @@ -1,3 +1,4 @@ +// ReSharper disable InconsistentNaming namespace Ryujinx.Tests.Unicorn.Native { public enum UnicornMode diff --git a/Ryujinx.Tests.Unicorn/UnicornAArch64.cs b/Ryujinx.Tests.Unicorn/UnicornAArch64.cs index 8ee4e76d..0425d1d3 100644 --- a/Ryujinx.Tests.Unicorn/UnicornAArch64.cs +++ b/Ryujinx.Tests.Unicorn/UnicornAArch64.cs @@ -1,3 +1,4 @@ +using Ryujinx.Tests.Unicorn.Native; using System; using System.Diagnostics.Contracts; using System.Runtime.Intrinsics; @@ -31,38 +32,38 @@ namespace Ryujinx.Tests.Unicorn public ulong LR { - get { return GetRegister(Native.ArmRegister.LR); } - set { SetRegister(Native.ArmRegister.LR, value); } + get { return GetRegister(ArmRegister.LR); } + set { SetRegister(ArmRegister.LR, value); } } public ulong SP { - get { return GetRegister(Native.ArmRegister.SP); } - set { SetRegister(Native.ArmRegister.SP, value); } + get { return GetRegister(ArmRegister.SP); } + set { SetRegister(ArmRegister.SP, value); } } public ulong PC { - get { return GetRegister(Native.ArmRegister.PC); } - set { SetRegister(Native.ArmRegister.PC, value); } + get { return GetRegister(ArmRegister.PC); } + set { SetRegister(ArmRegister.PC, value); } } public uint Pstate { - get { return (uint)GetRegister(Native.ArmRegister.PSTATE); } - set { SetRegister(Native.ArmRegister.PSTATE, (uint)value); } + get { return (uint)GetRegister(ArmRegister.PSTATE); } + set { SetRegister(ArmRegister.PSTATE, (uint)value); } } public int Fpcr { - get { return (int)GetRegister(Native.ArmRegister.FPCR); } - set { SetRegister(Native.ArmRegister.FPCR, (uint)value); } + get { return (int)GetRegister(ArmRegister.FPCR); } + set { SetRegister(ArmRegister.FPCR, (uint)value); } } public int Fpsr { - get { return (int)GetRegister(Native.ArmRegister.FPSR); } - set { SetRegister(Native.ArmRegister.FPSR, (uint)value); } + get { return (int)GetRegister(ArmRegister.FPSR); } + set { SetRegister(ArmRegister.FPSR, (uint)value); } } public bool OverflowFlag @@ -91,18 +92,18 @@ namespace Ryujinx.Tests.Unicorn public UnicornAArch64() { - Native.Interface.Checked(Native.Interface.uc_open((uint)Native.UnicornArch.UC_ARCH_ARM64, (uint)Native.UnicornMode.UC_MODE_LITTLE_ENDIAN, out uc)); - SetRegister(Native.ArmRegister.CPACR_EL1, 0x00300000); + Interface.Checked(Interface.uc_open((uint)UnicornArch.UC_ARCH_ARM64, (uint)UnicornMode.UC_MODE_LITTLE_ENDIAN, out uc)); + SetRegister(ArmRegister.CPACR_EL1, 0x00300000); } ~UnicornAArch64() { - Native.Interface.Checked(Native.Interface.uc_close(uc)); + Interface.Checked(Interface.uc_close(uc)); } public void RunForCount(ulong count) { - Native.Interface.Checked(Native.Interface.uc_emu_start(uc, this.PC, 0xFFFFFFFFFFFFFFFFu, 0, count)); + Interface.Checked(Interface.uc_emu_start(uc, PC, 0xFFFFFFFFFFFFFFFFu, 0, count)); } public void Step() @@ -110,94 +111,94 @@ namespace Ryujinx.Tests.Unicorn RunForCount(1); } - internal static Native.ArmRegister[] X_registers = new Native.ArmRegister[31] + internal static ArmRegister[] X_registers = new ArmRegister[31] { - Native.ArmRegister.X0, - Native.ArmRegister.X1, - Native.ArmRegister.X2, - Native.ArmRegister.X3, - Native.ArmRegister.X4, - Native.ArmRegister.X5, - Native.ArmRegister.X6, - Native.ArmRegister.X7, - Native.ArmRegister.X8, - Native.ArmRegister.X9, - Native.ArmRegister.X10, - Native.ArmRegister.X11, - Native.ArmRegister.X12, - Native.ArmRegister.X13, - Native.ArmRegister.X14, - Native.ArmRegister.X15, - Native.ArmRegister.X16, - Native.ArmRegister.X17, - Native.ArmRegister.X18, - Native.ArmRegister.X19, - Native.ArmRegister.X20, - Native.ArmRegister.X21, - Native.ArmRegister.X22, - Native.ArmRegister.X23, - Native.ArmRegister.X24, - Native.ArmRegister.X25, - Native.ArmRegister.X26, - Native.ArmRegister.X27, - Native.ArmRegister.X28, - Native.ArmRegister.X29, - Native.ArmRegister.X30, + ArmRegister.X0, + ArmRegister.X1, + ArmRegister.X2, + ArmRegister.X3, + ArmRegister.X4, + ArmRegister.X5, + ArmRegister.X6, + ArmRegister.X7, + ArmRegister.X8, + ArmRegister.X9, + ArmRegister.X10, + ArmRegister.X11, + ArmRegister.X12, + ArmRegister.X13, + ArmRegister.X14, + ArmRegister.X15, + ArmRegister.X16, + ArmRegister.X17, + ArmRegister.X18, + ArmRegister.X19, + ArmRegister.X20, + ArmRegister.X21, + ArmRegister.X22, + ArmRegister.X23, + ArmRegister.X24, + ArmRegister.X25, + ArmRegister.X26, + ArmRegister.X27, + ArmRegister.X28, + ArmRegister.X29, + ArmRegister.X30, }; - internal static Native.ArmRegister[] Q_registers = new Native.ArmRegister[32] + internal static ArmRegister[] Q_registers = new ArmRegister[32] { - Native.ArmRegister.Q0, - Native.ArmRegister.Q1, - Native.ArmRegister.Q2, - Native.ArmRegister.Q3, - Native.ArmRegister.Q4, - Native.ArmRegister.Q5, - Native.ArmRegister.Q6, - Native.ArmRegister.Q7, - Native.ArmRegister.Q8, - Native.ArmRegister.Q9, - Native.ArmRegister.Q10, - Native.ArmRegister.Q11, - Native.ArmRegister.Q12, - Native.ArmRegister.Q13, - Native.ArmRegister.Q14, - Native.ArmRegister.Q15, - Native.ArmRegister.Q16, - Native.ArmRegister.Q17, - Native.ArmRegister.Q18, - Native.ArmRegister.Q19, - Native.ArmRegister.Q20, - Native.ArmRegister.Q21, - Native.ArmRegister.Q22, - Native.ArmRegister.Q23, - Native.ArmRegister.Q24, - Native.ArmRegister.Q25, - Native.ArmRegister.Q26, - Native.ArmRegister.Q27, - Native.ArmRegister.Q28, - Native.ArmRegister.Q29, - Native.ArmRegister.Q30, - Native.ArmRegister.Q31, + ArmRegister.Q0, + ArmRegister.Q1, + ArmRegister.Q2, + ArmRegister.Q3, + ArmRegister.Q4, + ArmRegister.Q5, + ArmRegister.Q6, + ArmRegister.Q7, + ArmRegister.Q8, + ArmRegister.Q9, + ArmRegister.Q10, + ArmRegister.Q11, + ArmRegister.Q12, + ArmRegister.Q13, + ArmRegister.Q14, + ArmRegister.Q15, + ArmRegister.Q16, + ArmRegister.Q17, + ArmRegister.Q18, + ArmRegister.Q19, + ArmRegister.Q20, + ArmRegister.Q21, + ArmRegister.Q22, + ArmRegister.Q23, + ArmRegister.Q24, + ArmRegister.Q25, + ArmRegister.Q26, + ArmRegister.Q27, + ArmRegister.Q28, + ArmRegister.Q29, + ArmRegister.Q30, + ArmRegister.Q31, }; - internal ulong GetRegister(Native.ArmRegister register) + internal ulong GetRegister(ArmRegister register) { byte[] value_bytes = new byte[8]; - Native.Interface.Checked(Native.Interface.uc_reg_read(uc, (int)register, value_bytes)); + Interface.Checked(Interface.uc_reg_read(uc, (int)register, value_bytes)); return (ulong)BitConverter.ToInt64(value_bytes, 0); } - internal void SetRegister(Native.ArmRegister register, ulong value) + internal void SetRegister(ArmRegister register, ulong value) { byte[] value_bytes = BitConverter.GetBytes(value); - Native.Interface.Checked(Native.Interface.uc_reg_write(uc, (int)register, value_bytes)); + Interface.Checked(Interface.uc_reg_write(uc, (int)register, value_bytes)); } - internal Vector128 GetVector(Native.ArmRegister register) + internal Vector128 GetVector(ArmRegister register) { byte[] value_bytes = new byte[16]; - Native.Interface.Checked(Native.Interface.uc_reg_read(uc, (int)register, value_bytes)); + Interface.Checked(Interface.uc_reg_read(uc, (int)register, value_bytes)); unsafe { fixed (byte* p = &value_bytes[0]) @@ -207,7 +208,7 @@ namespace Ryujinx.Tests.Unicorn } } - internal void SetVector(Native.ArmRegister register, Vector128 value) + internal void SetVector(ArmRegister register, Vector128 value) { byte[] value_bytes = new byte[16]; unsafe @@ -217,7 +218,7 @@ namespace Ryujinx.Tests.Unicorn Sse.Store((float*)p, value); } } - Native.Interface.Checked(Native.Interface.uc_reg_write(uc, (int)register, value_bytes)); + Interface.Checked(Interface.uc_reg_write(uc, (int)register, value_bytes)); } public ulong GetX(int index) @@ -251,7 +252,7 @@ namespace Ryujinx.Tests.Unicorn public byte[] MemoryRead(ulong address, ulong size) { byte[] value = new byte[size]; - Native.Interface.Checked(Native.Interface.uc_mem_read(uc, address, value, size)); + Interface.Checked(Interface.uc_mem_read(uc, address, value, size)); return value; } @@ -262,7 +263,7 @@ namespace Ryujinx.Tests.Unicorn public void MemoryWrite(ulong address, byte[] value) { - Native.Interface.Checked(Native.Interface.uc_mem_write(uc, address, value, (ulong)value.Length)); + Interface.Checked(Interface.uc_mem_write(uc, address, value, (ulong)value.Length)); } public void MemoryWrite8 (ulong address, byte value) { MemoryWrite(address, new byte[]{value}); } @@ -275,23 +276,23 @@ namespace Ryujinx.Tests.Unicorn public void MemoryMap(ulong address, ulong size, MemoryPermission permissions) { - Native.Interface.Checked(Native.Interface.uc_mem_map(uc, address, size, (uint)permissions)); + Interface.Checked(Interface.uc_mem_map(uc, address, size, (uint)permissions)); } public void MemoryUnmap(ulong address, ulong size) { - Native.Interface.Checked(Native.Interface.uc_mem_unmap(uc, address, size)); + Interface.Checked(Interface.uc_mem_unmap(uc, address, size)); } public void MemoryProtect(ulong address, ulong size, MemoryPermission permissions) { - Native.Interface.Checked(Native.Interface.uc_mem_protect(uc, address, size, (uint)permissions)); + Interface.Checked(Interface.uc_mem_protect(uc, address, size, (uint)permissions)); } public void DumpMemoryInformation() { - Native.Interface.Checked(Native.Interface.uc_mem_regions(uc, out IntPtr regions_raw, out uint length)); - Native.Interface.MarshalArrayOf(regions_raw, (int)length, out var regions); + Interface.Checked(Interface.uc_mem_regions(uc, out IntPtr regions_raw, out uint length)); + Interface.MarshalArrayOf(regions_raw, (int)length, out var regions); foreach (var region in regions) { Console.WriteLine("region: begin {0:X16} end {1:X16} perms {2:X8}", region.begin, region.end, region.perms); @@ -302,7 +303,7 @@ namespace Ryujinx.Tests.Unicorn { try { - Native.Interface.uc_version(out uint major, out uint minor); + Interface.uc_version(out uint major, out uint minor); return true; } catch (DllNotFoundException) diff --git a/Ryujinx.Tests.Unicorn/UnicornError.cs b/Ryujinx.Tests.Unicorn/UnicornError.cs index 85833ea0..ac324089 100644 --- a/Ryujinx.Tests.Unicorn/UnicornError.cs +++ b/Ryujinx.Tests.Unicorn/UnicornError.cs @@ -1,3 +1,4 @@ +// ReSharper disable InconsistentNaming namespace Ryujinx.Tests.Unicorn { public enum UnicornError @@ -17,7 +18,7 @@ namespace Ryujinx.Tests.Unicorn UC_ERR_WRITE_PROT, // Quit emulation due to UC_MEM_WRITE_PROT violation: uc_emu_start() UC_ERR_READ_PROT, // Quit emulation due to UC_MEM_READ_PROT violation: uc_emu_start() UC_ERR_FETCH_PROT, // Quit emulation due to UC_MEM_FETCH_PROT violation: uc_emu_start() - UC_ERR_ARG, // Inavalid argument provided to uc_xxx function (See specific function API) + UC_ERR_ARG, // Invalid argument provided to uc_xxx function (See specific function API) UC_ERR_READ_UNALIGNED, // Unaligned read UC_ERR_WRITE_UNALIGNED, // Unaligned write UC_ERR_FETCH_UNALIGNED, // Unaligned fetch diff --git a/Ryujinx/Config.jsonc b/Ryujinx/Config.jsonc index 01013ec4..4bbdd5a4 100644 --- a/Ryujinx/Config.jsonc +++ b/Ryujinx/Config.jsonc @@ -4,19 +4,19 @@ // Dump shaders in local directory (e.g. `C:\ShaderDumps`) "graphics_shaders_dump_path": "", - // Enable print debug logs + // Enable printing debug logs "logging_enable_debug": false, - // Enable print stubbed calls logs + // Enable printing stubbed calls logs "logging_enable_stub": true, - // Enable print informations logs + // Enable printing information logs "logging_enable_info": true, - // Enable print warning logs + // Enable printing warning logs "logging_enable_warn": true, - // Enable print error logs + // Enable printing error logs "logging_enable_error": true, // Enable printing guest logs @@ -38,8 +38,8 @@ // Enable or disable Docked Mode "docked_mode": false, - // Enable or disable Discord Rich Presense - "enable_discord_intergration": true, + // Enable or disable Discord Rich Presence + "enable_discord_integration": true, // Enable or disable Game Vsync "enable_vsync": true, diff --git a/Ryujinx/Configuration.cs b/Ryujinx/Configuration.cs index 13e7c357..77895ac8 100644 --- a/Ryujinx/Configuration.cs +++ b/Ryujinx/Configuration.cs @@ -83,9 +83,9 @@ namespace Ryujinx public bool DockedMode { get; private set; } /// - /// Enables or disables Discord Rich Presense + /// Enables or disables Discord Rich Presence /// - public bool EnableDiscordIntergration { get; private set; } + public bool EnableDiscordIntegration { get; private set; } /// /// Enables or disables Vertical Sync @@ -220,7 +220,7 @@ namespace Ryujinx } } - device.System.State.DiscordIntergrationEnabled = Instance.EnableDiscordIntergration; + device.System.State.DiscordIntegrationEnabled = Instance.EnableDiscordIntegration; device.EnableDeviceVsync = Instance.EnableVsync; @@ -246,7 +246,7 @@ namespace Ryujinx ServiceConfiguration.IgnoreMissingServices = Instance.IgnoreMissingServices; - if(Instance.GamepadControls.Enabled) + if (Instance.GamepadControls.Enabled) { if (GamePad.GetName(Instance.GamepadControls.Index) == "Unmapped Controller") { @@ -254,8 +254,8 @@ namespace Ryujinx } } - device.Hid.InitilizePrimaryController(Instance.ControllerType); - device.Hid.InitilizeKeyboard(); + device.Hid.InitializePrimaryController(Instance.ControllerType); + device.Hid.InitializeKeyboard(); } private class ConfigurationEnumFormatter : IJsonFormatter @@ -274,10 +274,10 @@ namespace Ryujinx return default(T); } - var enumName = formatterResolver.GetFormatterWithVerify() - .Deserialize(ref reader, formatterResolver); + string enumName = formatterResolver.GetFormatterWithVerify() + .Deserialize(ref reader, formatterResolver); - if(Enum.TryParse(enumName, out T result)) + if (Enum.TryParse(enumName, out T result)) { return result; } diff --git a/Ryujinx/Program.cs b/Ryujinx/Program.cs index 6d8bbf39..ac668290 100644 --- a/Ryujinx/Program.cs +++ b/Ryujinx/Program.cs @@ -32,12 +32,12 @@ namespace Ryujinx Configuration.Load(Path.Combine(ApplicationDirectory, "Config.jsonc")); Configuration.Configure(device); - Profile.Initalize(); + Profile.Initialize(); AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit; - if (device.System.State.DiscordIntergrationEnabled == true) + if (device.System.State.DiscordIntegrationEnabled == true) { DiscordClient = new DiscordRpcClient("568815339807309834"); DiscordPresence = new RichPresence @@ -108,7 +108,7 @@ namespace Ryujinx Logger.PrintWarning(LogClass.Application, "Please specify the folder with the NSOs/IStorage or a NSO/NRO."); } - if (device.System.State.DiscordIntergrationEnabled == true) + if (device.System.State.DiscordIntegrationEnabled == true) { if (File.ReadAllLines(Path.Combine(ApplicationDirectory, "RPsupported.dat")).Contains(device.System.TitleID)) { diff --git a/Ryujinx/Ui/GLScreen.cs b/Ryujinx/Ui/GLScreen.cs index 2d43ac07..c5772799 100644 --- a/Ryujinx/Ui/GLScreen.cs +++ b/Ryujinx/Ui/GLScreen.cs @@ -4,7 +4,6 @@ using OpenTK.Input; using Ryujinx.Graphics.Gal; using Ryujinx.HLE; using Ryujinx.HLE.Input; -using Ryujinx.Profiler; using Ryujinx.Profiler.UI; using System; using System.Threading; @@ -97,7 +96,7 @@ namespace Ryujinx { RenderFrame(); - //Queue max. 1 vsync + // Queue max. 1 vsync ticks = Math.Min(ticks - ticksPerFrame, ticksPerFrame); } } @@ -113,7 +112,7 @@ namespace Ryujinx Context.MakeCurrent(null); - //OpenTK doesn't like sleeps in its thread, to avoid this a renderer thread is created + // OpenTK doesn't like sleeps in its thread, to avoid this a renderer thread is created _renderThread = new Thread(RenderLoop); _renderThread.Start(); @@ -134,7 +133,7 @@ namespace Ryujinx } } - //Polling becomes expensive if it's not slept + // Polling becomes expensive if it's not slept Thread.Sleep(1); } } @@ -152,7 +151,7 @@ namespace Ryujinx int rightJoystickDx = 0; int rightJoystickDy = 0; - //Keyboard Input + // Keyboard Input if (_keyboard.HasValue) { KeyboardState keyboard = _keyboard.Value; @@ -186,7 +185,7 @@ namespace Ryujinx currentButton |= Configuration.Instance.GamepadControls.GetButtons(); - //Keyboard has priority stick-wise + // Keyboard has priority stick-wise if (leftJoystickDx == 0 && leftJoystickDy == 0) { (leftJoystickDx, leftJoystickDy) = Configuration.Instance.GamepadControls.GetLeftStick(); @@ -213,8 +212,8 @@ namespace Ryujinx bool hasTouch = false; - //Get screen touch position from left mouse click - //OpenTK always captures mouse events, even if out of focus, so check if window is focused. + // Get screen touch position from left mouse click + // OpenTK always captures mouse events, even if out of focus, so check if window is focused. if (Focused && _mouse?.LeftButton == ButtonState.Pressed) { MouseState mouse = _mouse.Value; @@ -253,7 +252,7 @@ namespace Ryujinx X = mX, Y = mY, - //Placeholder values till more data is acquired + // Placeholder values till more data is acquired DiameterX = 10, DiameterY = 10, Angle = 90 diff --git a/Ryujinx/Ui/NpadController.cs b/Ryujinx/Ui/NpadController.cs index 1b677c4f..eddf0aa8 100644 --- a/Ryujinx/Ui/NpadController.cs +++ b/Ryujinx/Ui/NpadController.cs @@ -216,7 +216,7 @@ namespace Ryujinx.UI.Input case ControllerInputId.LTrigger: return gpState.Triggers.Left >= TriggerThreshold; case ControllerInputId.RTrigger: return gpState.Triggers.Right >= TriggerThreshold; - //Using thumbsticks as buttons is not common, but it would be nice not to ignore them + // Using thumbsticks as buttons is not common, but it would be nice not to ignore them case ControllerInputId.LJoystick: return gpState.ThumbSticks.Left.X >= Deadzone || gpState.ThumbSticks.Left.Y >= Deadzone; diff --git a/Ryujinx/Ui/NpadKeyboard.cs b/Ryujinx/Ui/NpadKeyboard.cs index f25e604b..1f758024 100644 --- a/Ryujinx/Ui/NpadKeyboard.cs +++ b/Ryujinx/Ui/NpadKeyboard.cs @@ -1,6 +1,5 @@ using OpenTK.Input; using Ryujinx.HLE.Input; -using Ryujinx.Common.Logging; namespace Ryujinx.UI.Input { diff --git a/Ryujinx/_schema.json b/Ryujinx/_schema.json index f83426b2..cf02e25f 100644 --- a/Ryujinx/_schema.json +++ b/Ryujinx/_schema.json @@ -393,11 +393,11 @@ false ] }, - "enable_discord_intergration": { - "$id": "#/properties/enable_discord_intergration", + "enable_discord_integration": { + "$id": "#/properties/enable_discord_integration", "type": "boolean", - "title": "Enable Discord Rich Presense", - "description": "Enable or disable Discord Rich Presense", + "title": "Enable Discord Rich Presence", + "description": "Enable or disable Discord Rich Presence", "default": true, "examples": [ true,