diff --git a/Utilities/IdManager.h b/Utilities/IdManager.h index 9ceb8ae66e..45d0d09970 100644 --- a/Utilities/IdManager.h +++ b/Utilities/IdManager.h @@ -50,6 +50,14 @@ struct ID { } + ID(ID&& other) + { + m_name = other.m_name; + m_attr = other.m_attr; + m_data = other.m_data; + other.m_data = nullptr; + } + void Kill() { delete m_data; diff --git a/Utilities/Thread.cpp b/Utilities/Thread.cpp index b71fc5eeea..940e6b94e9 100644 --- a/Utilities/Thread.cpp +++ b/Utilities/Thread.cpp @@ -35,6 +35,8 @@ ThreadBase::~ThreadBase() { if(IsAlive()) Stop(false); + + safe_delete(m_executor); } void ThreadBase::Start() diff --git a/rpcs3.sln b/rpcs3.sln index e8513ead3e..d060466e50 100644 --- a/rpcs3.sln +++ b/rpcs3.sln @@ -1,5 +1,5 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 +# Visual Studio Express 2013 for Windows Desktop VisualStudioVersion = 12.0.21005.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rpcs3", "rpcs3\rpcs3.vcxproj", "{70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}" @@ -82,12 +82,18 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxscintilla", "wxWidgets\bu EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug - MemLeak|Win32 = Debug - MemLeak|Win32 + Debug - MemLeak|x64 = Debug - MemLeak|x64 Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Debug - MemLeak|Win32.ActiveCfg = Debug - MemLeak|Win32 + {70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Debug - MemLeak|Win32.Build.0 = Debug - MemLeak|Win32 + {70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Debug - MemLeak|x64.ActiveCfg = Debug - MemLeak|x64 + {70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Debug - MemLeak|x64.Build.0 = Debug - MemLeak|x64 {70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Debug|Win32.ActiveCfg = Debug|Win32 {70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Debug|Win32.Build.0 = Debug|Win32 {70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Debug|x64.ActiveCfg = Debug|x64 @@ -96,6 +102,10 @@ Global {70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Release|Win32.Build.0 = Release|Win32 {70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Release|x64.ActiveCfg = Release|x64 {70CD65B0-91D6-4FAE-9A7B-4AF55D0D1B12}.Release|x64.Build.0 = Release|x64 + {6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}.Debug - MemLeak|Win32.ActiveCfg = Debug - MemLeak|Win32 + {6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}.Debug - MemLeak|Win32.Build.0 = Debug - MemLeak|Win32 + {6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}.Debug - MemLeak|x64.ActiveCfg = Debug - MemLeak|x64 + {6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}.Debug - MemLeak|x64.Build.0 = Debug - MemLeak|x64 {6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}.Debug|Win32.ActiveCfg = Debug|Win32 {6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}.Debug|Win32.Build.0 = Debug|Win32 {6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}.Debug|x64.ActiveCfg = Debug|x64 @@ -104,6 +114,10 @@ Global {6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}.Release|Win32.Build.0 = Release|Win32 {6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}.Release|x64.ActiveCfg = Release|x64 {6FCB55A5-563F-4039-1D79-1EB6ED8AAB82}.Release|x64.Build.0 = Release|x64 + {7047EE97-7F80-A70D-6147-BC11102DB6F4}.Debug - MemLeak|Win32.ActiveCfg = Debug - MemLeak|Win32 + {7047EE97-7F80-A70D-6147-BC11102DB6F4}.Debug - MemLeak|Win32.Build.0 = Debug - MemLeak|Win32 + {7047EE97-7F80-A70D-6147-BC11102DB6F4}.Debug - MemLeak|x64.ActiveCfg = Debug - MemLeak|x64 + {7047EE97-7F80-A70D-6147-BC11102DB6F4}.Debug - MemLeak|x64.Build.0 = Debug - MemLeak|x64 {7047EE97-7F80-A70D-6147-BC11102DB6F4}.Debug|Win32.ActiveCfg = Debug|Win32 {7047EE97-7F80-A70D-6147-BC11102DB6F4}.Debug|Win32.Build.0 = Debug|Win32 {7047EE97-7F80-A70D-6147-BC11102DB6F4}.Debug|x64.ActiveCfg = Debug|x64 @@ -112,6 +126,10 @@ Global {7047EE97-7F80-A70D-6147-BC11102DB6F4}.Release|Win32.Build.0 = Release|Win32 {7047EE97-7F80-A70D-6147-BC11102DB6F4}.Release|x64.ActiveCfg = Release|x64 {7047EE97-7F80-A70D-6147-BC11102DB6F4}.Release|x64.Build.0 = Release|x64 + {3111D679-7796-23C4-BA0C-271F1145DA24}.Debug - MemLeak|Win32.ActiveCfg = Debug - MemLeak|Win32 + {3111D679-7796-23C4-BA0C-271F1145DA24}.Debug - MemLeak|Win32.Build.0 = Debug - MemLeak|Win32 + {3111D679-7796-23C4-BA0C-271F1145DA24}.Debug - MemLeak|x64.ActiveCfg = Debug - MemLeak|x64 + {3111D679-7796-23C4-BA0C-271F1145DA24}.Debug - MemLeak|x64.Build.0 = Debug - MemLeak|x64 {3111D679-7796-23C4-BA0C-271F1145DA24}.Debug|Win32.ActiveCfg = Debug|Win32 {3111D679-7796-23C4-BA0C-271F1145DA24}.Debug|Win32.Build.0 = Debug|Win32 {3111D679-7796-23C4-BA0C-271F1145DA24}.Debug|x64.ActiveCfg = Debug|x64 @@ -120,6 +138,10 @@ Global {3111D679-7796-23C4-BA0C-271F1145DA24}.Release|Win32.Build.0 = Release|Win32 {3111D679-7796-23C4-BA0C-271F1145DA24}.Release|x64.ActiveCfg = Release|x64 {3111D679-7796-23C4-BA0C-271F1145DA24}.Release|x64.Build.0 = Release|x64 + {067D9406-2A93-DACA-9449-93A2D356357D}.Debug - MemLeak|Win32.ActiveCfg = Debug - MemLeak|Win32 + {067D9406-2A93-DACA-9449-93A2D356357D}.Debug - MemLeak|Win32.Build.0 = Debug - MemLeak|Win32 + {067D9406-2A93-DACA-9449-93A2D356357D}.Debug - MemLeak|x64.ActiveCfg = Debug - MemLeak|x64 + {067D9406-2A93-DACA-9449-93A2D356357D}.Debug - MemLeak|x64.Build.0 = Debug - MemLeak|x64 {067D9406-2A93-DACA-9449-93A2D356357D}.Debug|Win32.ActiveCfg = Debug|Win32 {067D9406-2A93-DACA-9449-93A2D356357D}.Debug|Win32.Build.0 = Debug|Win32 {067D9406-2A93-DACA-9449-93A2D356357D}.Debug|x64.ActiveCfg = Debug|x64 @@ -128,6 +150,10 @@ Global {067D9406-2A93-DACA-9449-93A2D356357D}.Release|Win32.Build.0 = Release|Win32 {067D9406-2A93-DACA-9449-93A2D356357D}.Release|x64.ActiveCfg = Release|x64 {067D9406-2A93-DACA-9449-93A2D356357D}.Release|x64.Build.0 = Release|x64 + {9ED1866B-D4AE-3440-24E4-7A9475B163B2}.Debug - MemLeak|Win32.ActiveCfg = Debug - MemLeak|Win32 + {9ED1866B-D4AE-3440-24E4-7A9475B163B2}.Debug - MemLeak|Win32.Build.0 = Debug - MemLeak|Win32 + {9ED1866B-D4AE-3440-24E4-7A9475B163B2}.Debug - MemLeak|x64.ActiveCfg = Debug - MemLeak|x64 + {9ED1866B-D4AE-3440-24E4-7A9475B163B2}.Debug - MemLeak|x64.Build.0 = Debug - MemLeak|x64 {9ED1866B-D4AE-3440-24E4-7A9475B163B2}.Debug|Win32.ActiveCfg = Debug|Win32 {9ED1866B-D4AE-3440-24E4-7A9475B163B2}.Debug|Win32.Build.0 = Debug|Win32 {9ED1866B-D4AE-3440-24E4-7A9475B163B2}.Debug|x64.ActiveCfg = Debug|x64 @@ -136,6 +162,10 @@ Global {9ED1866B-D4AE-3440-24E4-7A9475B163B2}.Release|Win32.Build.0 = Release|Win32 {9ED1866B-D4AE-3440-24E4-7A9475B163B2}.Release|x64.ActiveCfg = Release|x64 {9ED1866B-D4AE-3440-24E4-7A9475B163B2}.Release|x64.Build.0 = Release|x64 + {99C9EB95-DB4C-1996-490E-5212EFBF07C3}.Debug - MemLeak|Win32.ActiveCfg = Debug - MemLeak|Win32 + {99C9EB95-DB4C-1996-490E-5212EFBF07C3}.Debug - MemLeak|Win32.Build.0 = Debug - MemLeak|Win32 + {99C9EB95-DB4C-1996-490E-5212EFBF07C3}.Debug - MemLeak|x64.ActiveCfg = Debug - MemLeak|x64 + {99C9EB95-DB4C-1996-490E-5212EFBF07C3}.Debug - MemLeak|x64.Build.0 = Debug - MemLeak|x64 {99C9EB95-DB4C-1996-490E-5212EFBF07C3}.Debug|Win32.ActiveCfg = Debug|Win32 {99C9EB95-DB4C-1996-490E-5212EFBF07C3}.Debug|Win32.Build.0 = Debug|Win32 {99C9EB95-DB4C-1996-490E-5212EFBF07C3}.Debug|x64.ActiveCfg = Debug|x64 @@ -144,6 +174,10 @@ Global {99C9EB95-DB4C-1996-490E-5212EFBF07C3}.Release|Win32.Build.0 = Release|Win32 {99C9EB95-DB4C-1996-490E-5212EFBF07C3}.Release|x64.ActiveCfg = Release|x64 {99C9EB95-DB4C-1996-490E-5212EFBF07C3}.Release|x64.Build.0 = Release|x64 + {6EDC3B79-D217-F11A-406F-F11D856493F9}.Debug - MemLeak|Win32.ActiveCfg = Debug - MemLeak|Win32 + {6EDC3B79-D217-F11A-406F-F11D856493F9}.Debug - MemLeak|Win32.Build.0 = Debug - MemLeak|Win32 + {6EDC3B79-D217-F11A-406F-F11D856493F9}.Debug - MemLeak|x64.ActiveCfg = Debug - MemLeak|x64 + {6EDC3B79-D217-F11A-406F-F11D856493F9}.Debug - MemLeak|x64.Build.0 = Debug - MemLeak|x64 {6EDC3B79-D217-F11A-406F-F11D856493F9}.Debug|Win32.ActiveCfg = Debug|Win32 {6EDC3B79-D217-F11A-406F-F11D856493F9}.Debug|Win32.Build.0 = Debug|Win32 {6EDC3B79-D217-F11A-406F-F11D856493F9}.Debug|x64.ActiveCfg = Debug|x64 @@ -152,6 +186,10 @@ Global {6EDC3B79-D217-F11A-406F-F11D856493F9}.Release|Win32.Build.0 = Release|Win32 {6EDC3B79-D217-F11A-406F-F11D856493F9}.Release|x64.ActiveCfg = Release|x64 {6EDC3B79-D217-F11A-406F-F11D856493F9}.Release|x64.Build.0 = Release|x64 + {A9AC9CF5-8E6C-0BA2-0769-6E42EDB88E25}.Debug - MemLeak|Win32.ActiveCfg = Debug - MemLeak|Win32 + {A9AC9CF5-8E6C-0BA2-0769-6E42EDB88E25}.Debug - MemLeak|Win32.Build.0 = Debug - MemLeak|Win32 + {A9AC9CF5-8E6C-0BA2-0769-6E42EDB88E25}.Debug - MemLeak|x64.ActiveCfg = Debug - MemLeak|x64 + {A9AC9CF5-8E6C-0BA2-0769-6E42EDB88E25}.Debug - MemLeak|x64.Build.0 = Debug - MemLeak|x64 {A9AC9CF5-8E6C-0BA2-0769-6E42EDB88E25}.Debug|Win32.ActiveCfg = Debug|Win32 {A9AC9CF5-8E6C-0BA2-0769-6E42EDB88E25}.Debug|Win32.Build.0 = Debug|Win32 {A9AC9CF5-8E6C-0BA2-0769-6E42EDB88E25}.Debug|x64.ActiveCfg = Debug|x64 @@ -160,6 +198,10 @@ Global {A9AC9CF5-8E6C-0BA2-0769-6E42EDB88E25}.Release|Win32.Build.0 = Release|Win32 {A9AC9CF5-8E6C-0BA2-0769-6E42EDB88E25}.Release|x64.ActiveCfg = Release|x64 {A9AC9CF5-8E6C-0BA2-0769-6E42EDB88E25}.Release|x64.Build.0 = Release|x64 + {CD478F02-7550-58A5-E085-CE4BC0C0AD23}.Debug - MemLeak|Win32.ActiveCfg = Debug - MemLeak|Win32 + {CD478F02-7550-58A5-E085-CE4BC0C0AD23}.Debug - MemLeak|Win32.Build.0 = Debug - MemLeak|Win32 + {CD478F02-7550-58A5-E085-CE4BC0C0AD23}.Debug - MemLeak|x64.ActiveCfg = Debug - MemLeak|x64 + {CD478F02-7550-58A5-E085-CE4BC0C0AD23}.Debug - MemLeak|x64.Build.0 = Debug - MemLeak|x64 {CD478F02-7550-58A5-E085-CE4BC0C0AD23}.Debug|Win32.ActiveCfg = Debug|Win32 {CD478F02-7550-58A5-E085-CE4BC0C0AD23}.Debug|Win32.Build.0 = Debug|Win32 {CD478F02-7550-58A5-E085-CE4BC0C0AD23}.Debug|x64.ActiveCfg = Debug|x64 @@ -168,6 +210,10 @@ Global {CD478F02-7550-58A5-E085-CE4BC0C0AD23}.Release|Win32.Build.0 = Release|Win32 {CD478F02-7550-58A5-E085-CE4BC0C0AD23}.Release|x64.ActiveCfg = Release|x64 {CD478F02-7550-58A5-E085-CE4BC0C0AD23}.Release|x64.Build.0 = Release|x64 + {22B14659-C5B6-B775-868D-A49198FEAD4A}.Debug - MemLeak|Win32.ActiveCfg = Debug - MemLeak|Win32 + {22B14659-C5B6-B775-868D-A49198FEAD4A}.Debug - MemLeak|Win32.Build.0 = Debug - MemLeak|Win32 + {22B14659-C5B6-B775-868D-A49198FEAD4A}.Debug - MemLeak|x64.ActiveCfg = Debug - MemLeak|x64 + {22B14659-C5B6-B775-868D-A49198FEAD4A}.Debug - MemLeak|x64.Build.0 = Debug - MemLeak|x64 {22B14659-C5B6-B775-868D-A49198FEAD4A}.Debug|Win32.ActiveCfg = Debug|Win32 {22B14659-C5B6-B775-868D-A49198FEAD4A}.Debug|Win32.Build.0 = Debug|Win32 {22B14659-C5B6-B775-868D-A49198FEAD4A}.Debug|x64.ActiveCfg = Debug|x64 @@ -176,6 +222,10 @@ Global {22B14659-C5B6-B775-868D-A49198FEAD4A}.Release|Win32.Build.0 = Release|Win32 {22B14659-C5B6-B775-868D-A49198FEAD4A}.Release|x64.ActiveCfg = Release|x64 {22B14659-C5B6-B775-868D-A49198FEAD4A}.Release|x64.Build.0 = Release|x64 + {FAF0CB93-F7CE-A6B8-8342-19CE99BAF774}.Debug - MemLeak|Win32.ActiveCfg = Debug - MemLeak|Win32 + {FAF0CB93-F7CE-A6B8-8342-19CE99BAF774}.Debug - MemLeak|Win32.Build.0 = Debug - MemLeak|Win32 + {FAF0CB93-F7CE-A6B8-8342-19CE99BAF774}.Debug - MemLeak|x64.ActiveCfg = Debug - MemLeak|x64 + {FAF0CB93-F7CE-A6B8-8342-19CE99BAF774}.Debug - MemLeak|x64.Build.0 = Debug - MemLeak|x64 {FAF0CB93-F7CE-A6B8-8342-19CE99BAF774}.Debug|Win32.ActiveCfg = Debug|Win32 {FAF0CB93-F7CE-A6B8-8342-19CE99BAF774}.Debug|Win32.Build.0 = Debug|Win32 {FAF0CB93-F7CE-A6B8-8342-19CE99BAF774}.Debug|x64.ActiveCfg = Debug|x64 @@ -184,6 +234,10 @@ Global {FAF0CB93-F7CE-A6B8-8342-19CE99BAF774}.Release|Win32.Build.0 = Release|Win32 {FAF0CB93-F7CE-A6B8-8342-19CE99BAF774}.Release|x64.ActiveCfg = Release|x64 {FAF0CB93-F7CE-A6B8-8342-19CE99BAF774}.Release|x64.Build.0 = Release|x64 + {46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2}.Debug - MemLeak|Win32.ActiveCfg = Debug - MemLeak|Win32 + {46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2}.Debug - MemLeak|Win32.Build.0 = Debug - MemLeak|Win32 + {46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2}.Debug - MemLeak|x64.ActiveCfg = Debug - MemLeak|x64 + {46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2}.Debug - MemLeak|x64.Build.0 = Debug - MemLeak|x64 {46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2}.Debug|Win32.ActiveCfg = Debug|Win32 {46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2}.Debug|Win32.Build.0 = Debug|Win32 {46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2}.Debug|x64.ActiveCfg = Debug|x64 @@ -192,6 +246,10 @@ Global {46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2}.Release|Win32.Build.0 = Release|Win32 {46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2}.Release|x64.ActiveCfg = Release|x64 {46333DC3-B4A5-3DCC-E8BF-A3F20ADC56D2}.Release|x64.Build.0 = Release|x64 + {5C363C34-4741-7036-861C-2E2279CF552E}.Debug - MemLeak|Win32.ActiveCfg = Debug - MemLeak|Win32 + {5C363C34-4741-7036-861C-2E2279CF552E}.Debug - MemLeak|Win32.Build.0 = Debug - MemLeak|Win32 + {5C363C34-4741-7036-861C-2E2279CF552E}.Debug - MemLeak|x64.ActiveCfg = Debug - MemLeak|x64 + {5C363C34-4741-7036-861C-2E2279CF552E}.Debug - MemLeak|x64.Build.0 = Debug - MemLeak|x64 {5C363C34-4741-7036-861C-2E2279CF552E}.Debug|Win32.ActiveCfg = Debug|Win32 {5C363C34-4741-7036-861C-2E2279CF552E}.Debug|Win32.Build.0 = Debug|Win32 {5C363C34-4741-7036-861C-2E2279CF552E}.Debug|x64.ActiveCfg = Debug|x64 @@ -200,6 +258,10 @@ Global {5C363C34-4741-7036-861C-2E2279CF552E}.Release|Win32.Build.0 = Release|Win32 {5C363C34-4741-7036-861C-2E2279CF552E}.Release|x64.ActiveCfg = Release|x64 {5C363C34-4741-7036-861C-2E2279CF552E}.Release|x64.Build.0 = Release|x64 + {76169FE8-0814-4F36-6409-699EF1A23001}.Debug - MemLeak|Win32.ActiveCfg = Debug - MemLeak|Win32 + {76169FE8-0814-4F36-6409-699EF1A23001}.Debug - MemLeak|Win32.Build.0 = Debug - MemLeak|Win32 + {76169FE8-0814-4F36-6409-699EF1A23001}.Debug - MemLeak|x64.ActiveCfg = Debug - MemLeak|x64 + {76169FE8-0814-4F36-6409-699EF1A23001}.Debug - MemLeak|x64.Build.0 = Debug - MemLeak|x64 {76169FE8-0814-4F36-6409-699EF1A23001}.Debug|Win32.ActiveCfg = Debug|Win32 {76169FE8-0814-4F36-6409-699EF1A23001}.Debug|Win32.Build.0 = Debug|Win32 {76169FE8-0814-4F36-6409-699EF1A23001}.Debug|x64.ActiveCfg = Debug|x64 @@ -208,6 +270,10 @@ Global {76169FE8-0814-4F36-6409-699EF1A23001}.Release|Win32.Build.0 = Release|Win32 {76169FE8-0814-4F36-6409-699EF1A23001}.Release|x64.ActiveCfg = Release|x64 {76169FE8-0814-4F36-6409-699EF1A23001}.Release|x64.Build.0 = Release|x64 + {949C6DB8-E638-6EC6-AB31-BCCFD1379E01}.Debug - MemLeak|Win32.ActiveCfg = Debug - MemLeak|Win32 + {949C6DB8-E638-6EC6-AB31-BCCFD1379E01}.Debug - MemLeak|Win32.Build.0 = Debug - MemLeak|Win32 + {949C6DB8-E638-6EC6-AB31-BCCFD1379E01}.Debug - MemLeak|x64.ActiveCfg = Debug - MemLeak|x64 + {949C6DB8-E638-6EC6-AB31-BCCFD1379E01}.Debug - MemLeak|x64.Build.0 = Debug - MemLeak|x64 {949C6DB8-E638-6EC6-AB31-BCCFD1379E01}.Debug|Win32.ActiveCfg = Debug|Win32 {949C6DB8-E638-6EC6-AB31-BCCFD1379E01}.Debug|Win32.Build.0 = Debug|Win32 {949C6DB8-E638-6EC6-AB31-BCCFD1379E01}.Debug|x64.ActiveCfg = Debug|x64 @@ -216,6 +282,10 @@ Global {949C6DB8-E638-6EC6-AB31-BCCFD1379E01}.Release|Win32.Build.0 = Release|Win32 {949C6DB8-E638-6EC6-AB31-BCCFD1379E01}.Release|x64.ActiveCfg = Release|x64 {949C6DB8-E638-6EC6-AB31-BCCFD1379E01}.Release|x64.Build.0 = Release|x64 + {B87216CD-6C64-1DB0-D900-BC6E745C1DF9}.Debug - MemLeak|Win32.ActiveCfg = Debug - MemLeak|Win32 + {B87216CD-6C64-1DB0-D900-BC6E745C1DF9}.Debug - MemLeak|Win32.Build.0 = Debug - MemLeak|Win32 + {B87216CD-6C64-1DB0-D900-BC6E745C1DF9}.Debug - MemLeak|x64.ActiveCfg = Debug - MemLeak|x64 + {B87216CD-6C64-1DB0-D900-BC6E745C1DF9}.Debug - MemLeak|x64.Build.0 = Debug - MemLeak|x64 {B87216CD-6C64-1DB0-D900-BC6E745C1DF9}.Debug|Win32.ActiveCfg = Debug|Win32 {B87216CD-6C64-1DB0-D900-BC6E745C1DF9}.Debug|Win32.Build.0 = Debug|Win32 {B87216CD-6C64-1DB0-D900-BC6E745C1DF9}.Debug|x64.ActiveCfg = Debug|x64 @@ -224,6 +294,10 @@ Global {B87216CD-6C64-1DB0-D900-BC6E745C1DF9}.Release|Win32.Build.0 = Release|Win32 {B87216CD-6C64-1DB0-D900-BC6E745C1DF9}.Release|x64.ActiveCfg = Release|x64 {B87216CD-6C64-1DB0-D900-BC6E745C1DF9}.Release|x64.Build.0 = Release|x64 + {AFF2C68B-B867-DD50-6AC5-74B09D41F8EA}.Debug - MemLeak|Win32.ActiveCfg = Debug - MemLeak|Win32 + {AFF2C68B-B867-DD50-6AC5-74B09D41F8EA}.Debug - MemLeak|Win32.Build.0 = Debug - MemLeak|Win32 + {AFF2C68B-B867-DD50-6AC5-74B09D41F8EA}.Debug - MemLeak|x64.ActiveCfg = Debug - MemLeak|x64 + {AFF2C68B-B867-DD50-6AC5-74B09D41F8EA}.Debug - MemLeak|x64.Build.0 = Debug - MemLeak|x64 {AFF2C68B-B867-DD50-6AC5-74B09D41F8EA}.Debug|Win32.ActiveCfg = Debug|Win32 {AFF2C68B-B867-DD50-6AC5-74B09D41F8EA}.Debug|Win32.Build.0 = Debug|Win32 {AFF2C68B-B867-DD50-6AC5-74B09D41F8EA}.Debug|x64.ActiveCfg = Debug|x64 @@ -232,6 +306,10 @@ Global {AFF2C68B-B867-DD50-6AC5-74B09D41F8EA}.Release|Win32.Build.0 = Release|Win32 {AFF2C68B-B867-DD50-6AC5-74B09D41F8EA}.Release|x64.ActiveCfg = Release|x64 {AFF2C68B-B867-DD50-6AC5-74B09D41F8EA}.Release|x64.Build.0 = Release|x64 + {6FDC76D5-CB44-B9F8-5EF6-C59B020719DF}.Debug - MemLeak|Win32.ActiveCfg = Debug - MemLeak|Win32 + {6FDC76D5-CB44-B9F8-5EF6-C59B020719DF}.Debug - MemLeak|Win32.Build.0 = Debug - MemLeak|Win32 + {6FDC76D5-CB44-B9F8-5EF6-C59B020719DF}.Debug - MemLeak|x64.ActiveCfg = Debug - MemLeak|x64 + {6FDC76D5-CB44-B9F8-5EF6-C59B020719DF}.Debug - MemLeak|x64.Build.0 = Debug - MemLeak|x64 {6FDC76D5-CB44-B9F8-5EF6-C59B020719DF}.Debug|Win32.ActiveCfg = Debug|Win32 {6FDC76D5-CB44-B9F8-5EF6-C59B020719DF}.Debug|Win32.Build.0 = Debug|Win32 {6FDC76D5-CB44-B9F8-5EF6-C59B020719DF}.Debug|x64.ActiveCfg = Debug|x64 @@ -240,6 +318,10 @@ Global {6FDC76D5-CB44-B9F8-5EF6-C59B020719DF}.Release|Win32.Build.0 = Release|Win32 {6FDC76D5-CB44-B9F8-5EF6-C59B020719DF}.Release|x64.ActiveCfg = Release|x64 {6FDC76D5-CB44-B9F8-5EF6-C59B020719DF}.Release|x64.Build.0 = Release|x64 + {8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6}.Debug - MemLeak|Win32.ActiveCfg = Debug - MemLeak|Win32 + {8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6}.Debug - MemLeak|Win32.Build.0 = Debug - MemLeak|Win32 + {8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6}.Debug - MemLeak|x64.ActiveCfg = Debug - MemLeak|x64 + {8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6}.Debug - MemLeak|x64.Build.0 = Debug - MemLeak|x64 {8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6}.Debug|Win32.ActiveCfg = Debug|Win32 {8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6}.Debug|Win32.Build.0 = Debug|Win32 {8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6}.Debug|x64.ActiveCfg = Debug|x64 @@ -248,6 +330,10 @@ Global {8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6}.Release|Win32.Build.0 = Release|Win32 {8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6}.Release|x64.ActiveCfg = Release|x64 {8BECCA95-C7D7-CFF8-FDB1-4950E9F8E8E6}.Release|x64.Build.0 = Release|x64 + {87B42A9C-3F5C-53D7-9017-2B1CAE39457D}.Debug - MemLeak|Win32.ActiveCfg = Debug - MemLeak|Win32 + {87B42A9C-3F5C-53D7-9017-2B1CAE39457D}.Debug - MemLeak|Win32.Build.0 = Debug - MemLeak|Win32 + {87B42A9C-3F5C-53D7-9017-2B1CAE39457D}.Debug - MemLeak|x64.ActiveCfg = Debug - MemLeak|x64 + {87B42A9C-3F5C-53D7-9017-2B1CAE39457D}.Debug - MemLeak|x64.Build.0 = Debug - MemLeak|x64 {87B42A9C-3F5C-53D7-9017-2B1CAE39457D}.Debug|Win32.ActiveCfg = Debug|Win32 {87B42A9C-3F5C-53D7-9017-2B1CAE39457D}.Debug|Win32.Build.0 = Debug|Win32 {87B42A9C-3F5C-53D7-9017-2B1CAE39457D}.Debug|x64.ActiveCfg = Debug|x64 @@ -256,6 +342,10 @@ Global {87B42A9C-3F5C-53D7-9017-2B1CAE39457D}.Release|Win32.Build.0 = Release|Win32 {87B42A9C-3F5C-53D7-9017-2B1CAE39457D}.Release|x64.ActiveCfg = Release|x64 {87B42A9C-3F5C-53D7-9017-2B1CAE39457D}.Release|x64.Build.0 = Release|x64 + {23E1C437-A951-5943-8639-A17F3CF2E606}.Debug - MemLeak|Win32.ActiveCfg = Debug - MemLeak|Win32 + {23E1C437-A951-5943-8639-A17F3CF2E606}.Debug - MemLeak|Win32.Build.0 = Debug - MemLeak|Win32 + {23E1C437-A951-5943-8639-A17F3CF2E606}.Debug - MemLeak|x64.ActiveCfg = Debug - MemLeak|x64 + {23E1C437-A951-5943-8639-A17F3CF2E606}.Debug - MemLeak|x64.Build.0 = Debug - MemLeak|x64 {23E1C437-A951-5943-8639-A17F3CF2E606}.Debug|Win32.ActiveCfg = Debug|Win32 {23E1C437-A951-5943-8639-A17F3CF2E606}.Debug|Win32.Build.0 = Debug|Win32 {23E1C437-A951-5943-8639-A17F3CF2E606}.Debug|x64.ActiveCfg = Debug|x64 @@ -264,6 +354,10 @@ Global {23E1C437-A951-5943-8639-A17F3CF2E606}.Release|Win32.Build.0 = Release|Win32 {23E1C437-A951-5943-8639-A17F3CF2E606}.Release|x64.ActiveCfg = Release|x64 {23E1C437-A951-5943-8639-A17F3CF2E606}.Release|x64.Build.0 = Release|x64 + {74827EBD-93DC-5110-BA95-3F2AB029B6B0}.Debug - MemLeak|Win32.ActiveCfg = Debug - MemLeak|Win32 + {74827EBD-93DC-5110-BA95-3F2AB029B6B0}.Debug - MemLeak|Win32.Build.0 = Debug - MemLeak|Win32 + {74827EBD-93DC-5110-BA95-3F2AB029B6B0}.Debug - MemLeak|x64.ActiveCfg = Debug - MemLeak|x64 + {74827EBD-93DC-5110-BA95-3F2AB029B6B0}.Debug - MemLeak|x64.Build.0 = Debug - MemLeak|x64 {74827EBD-93DC-5110-BA95-3F2AB029B6B0}.Debug|Win32.ActiveCfg = Debug|Win32 {74827EBD-93DC-5110-BA95-3F2AB029B6B0}.Debug|Win32.Build.0 = Debug|Win32 {74827EBD-93DC-5110-BA95-3F2AB029B6B0}.Debug|x64.ActiveCfg = Debug|x64 diff --git a/rpcs3/Emu/CPU/CPUDecoder.h b/rpcs3/Emu/CPU/CPUDecoder.h index 082d92ac74..95b168b7af 100644 --- a/rpcs3/Emu/CPU/CPUDecoder.h +++ b/rpcs3/Emu/CPU/CPUDecoder.h @@ -7,15 +7,15 @@ class CPUDecoder { public: virtual u8 DecodeMemory(const u64 address)=0; + + virtual ~CPUDecoder() = default; }; template class InstrCaller { public: - virtual ~InstrCaller() - { - } + virtual ~InstrCaller() = default; virtual void operator ()(TO* op, u32 code) const = 0; @@ -334,6 +334,17 @@ public: }); } + virtual ~InstrBase() + { + if (m_args) { + // m_args contains pointers to statically allocated CodeFieldBase objects + // We shouldn't call delete on these, they aren't allocated with new + + // The m_args array itself, however, should be deleted + delete[] m_args; + } + } + __forceinline const std::string& GetName() const { return m_name; @@ -396,12 +407,54 @@ public: virtual ~InstrList() { - for(int i=0; i* deleteMe = m_instrs[i]; + + if (deleteMe) { // deleteMe will be a nullptr if we've already deleted it through another reference + // Remove any instances of pointers to this instruction caller from our m_instrs list + m_instrs[i] = nullptr; + for (int j = i + 1; j < count; j++) { + if (m_instrs[j] == deleteMe) { + m_instrs[j] = nullptr; + } + } + + // If we're deleting the error handler here, remember it so we don't try to delete it again later + if (deleteMe == m_error_func) { + deletedErrorFunc = true; + } + + // Delete the instruction caller + delete deleteMe; + } } - delete m_error_func; + // Clean up m_instrs_info + for (int i = 0; i < count; ++i) + { + InstrBase* deleteMe = m_instrs_info[i]; + + if (deleteMe) { + m_instrs_info[i] = nullptr; + for (int j = i + 1; j < count; j++) { + if (m_instrs_info[j] == deleteMe) { + m_instrs[j] = nullptr; + } + } + + delete deleteMe; + } + } + + // If we haven't already deleted our error handler, and we have one, then delete it now + if (!deletedErrorFunc && m_error_func) + { + delete m_error_func; + } } void set_parent(InstrCaller* parent, int opcode) diff --git a/rpcs3/Emu/CPU/CPUThread.cpp b/rpcs3/Emu/CPU/CPUThread.cpp index 80917856c8..9ae338ce2d 100644 --- a/rpcs3/Emu/CPU/CPUThread.cpp +++ b/rpcs3/Emu/CPU/CPUThread.cpp @@ -26,6 +26,7 @@ CPUThread::CPUThread(CPUThreadType type) CPUThread::~CPUThread() { + safe_delete(m_dec); } void CPUThread::Close() diff --git a/rpcs3/Emu/CPU/CPUThreadManager.cpp b/rpcs3/Emu/CPU/CPUThreadManager.cpp index b89c92725d..d29c5e6373 100644 --- a/rpcs3/Emu/CPU/CPUThreadManager.cpp +++ b/rpcs3/Emu/CPU/CPUThreadManager.cpp @@ -46,31 +46,38 @@ CPUThread& CPUThreadManager::AddThread(CPUThreadType type) return *new_thread; } -//TODO: find out where the thread is actually deleted because it's sure as shit not here void CPUThreadManager::RemoveThread(const u32 id) { std::lock_guard lock(m_mtx_thread); - for(u32 i=0; im_wait_thread_id == id) + if (m_threads[i]->m_wait_thread_id == id) { m_threads[i]->Wait(false); m_threads[i]->m_wait_thread_id = -1; } - if(m_threads[i]->GetId() != id) continue; + if (m_threads[i]->GetId() != id) continue; - CPUThread* thr = m_threads[i]; + thr = m_threads[i]; + thread_index = i; + } + + if (thr) + { #ifndef QT_UI wxGetApp().SendDbgCommand(DID_REMOVE_THREAD, thr); #endif thr->Close(); - m_threads.erase(m_threads.begin()+ i); - break; + m_threads.erase(m_threads.begin() + thread_index); } + // Removing the ID should trigger the actual deletion of the thread Emu.GetIdManager().RemoveID(id); Emu.CheckStatus(); } diff --git a/rpcs3/Emu/Cell/PPCDecoder.h b/rpcs3/Emu/Cell/PPCDecoder.h index 3185a441a9..866d16a990 100644 --- a/rpcs3/Emu/Cell/PPCDecoder.h +++ b/rpcs3/Emu/Cell/PPCDecoder.h @@ -8,6 +8,8 @@ public: virtual void Decode(const u32 code)=0; virtual u8 DecodeMemory(const u64 address); + + virtual ~PPCDecoder() = default; }; diff --git a/rpcs3/Emu/Cell/PPUDecoder.h b/rpcs3/Emu/Cell/PPUDecoder.h index d5973edb6a..97132b07e9 100644 --- a/rpcs3/Emu/Cell/PPUDecoder.h +++ b/rpcs3/Emu/Cell/PPUDecoder.h @@ -9,11 +9,11 @@ class PPUDecoder : public PPCDecoder PPUOpcodes* m_op; public: - PPUDecoder(PPUOpcodes& op) : m_op(&op) + PPUDecoder(PPUOpcodes* op) : m_op(op) { } - ~PPUDecoder() + virtual ~PPUDecoder() { delete m_op; } diff --git a/rpcs3/Emu/Cell/PPUInstrTable.h b/rpcs3/Emu/Cell/PPUInstrTable.h index 52767e92bc..c1bc040877 100644 --- a/rpcs3/Emu/Cell/PPUInstrTable.h +++ b/rpcs3/Emu/Cell/PPUInstrTable.h @@ -203,7 +203,9 @@ namespace PPU_instr static CodeField<9, 10> STRM; - static auto main_list = new_list(OPCD, instr_bind(&PPUOpcodes::UNK, GetCode, OPCD, OPCD)); + //static auto main_list = new_list(OPCD, instr_bind(&PPUOpcodes::UNK, GetCode, OPCD, OPCD)); + static InstrList<1 << CodeField<0, 5>::size, ::PPUOpcodes> main_list_obj(OPCD, instr_bind(&PPUOpcodes::UNK, GetCode, OPCD, OPCD)); + static auto main_list = &main_list_obj; static auto g04_list = new_list(main_list, PPU_opcodes::G_04, GD_04); static auto g04_0_list = new_list(g04_list, GD_04_0, instr_bind(&PPUOpcodes::UNK, GetCode, OPCD, GD_04_0)); static auto g13_list = new_list(main_list, PPU_opcodes::G_13, GD_13, instr_bind(&PPUOpcodes::UNK, GetCode, OPCD, GD_13)); diff --git a/rpcs3/Emu/Cell/PPUThread.cpp b/rpcs3/Emu/Cell/PPUThread.cpp index 6eed6004f2..63d86ac28b 100644 --- a/rpcs3/Emu/Cell/PPUThread.cpp +++ b/rpcs3/Emu/Cell/PPUThread.cpp @@ -150,7 +150,8 @@ void PPUThread::DoRun() case 1: case 2: - m_dec = new PPUDecoder(*new PPUInterpreter(*this)); + auto ppui = new PPUInterpreter(*this); + m_dec = new PPUDecoder(ppui); break; } } diff --git a/rpcs3/Emu/Cell/SPUInstrTable.h b/rpcs3/Emu/Cell/SPUInstrTable.h index bfbe113237..2349f4aab6 100644 --- a/rpcs3/Emu/Cell/SPUInstrTable.h +++ b/rpcs3/Emu/Cell/SPUInstrTable.h @@ -39,7 +39,9 @@ namespace SPU_instr static CodeField<18, 31> L_18_31; static CodeField<11> L_11; - static auto rrr_list = new_list(RRR); + // static auto rrr_list = new_list(RRR); + static InstrList<1 << CodeField<0, 3>::size, SPUOpcodes> rrr_list_obj(RRR, nullptr); + static auto rrr_list = &rrr_list_obj; static auto ri18_list = new_list(rrr_list, RI18); static auto ri10_list = new_list(ri18_list, RI10); static auto ri16_list = new_list(ri10_list, RI16); diff --git a/rpcs3/Emu/Cell/SPUThread.h b/rpcs3/Emu/Cell/SPUThread.h index 5bc6843b8c..b4b9807f45 100644 --- a/rpcs3/Emu/Cell/SPUThread.h +++ b/rpcs3/Emu/Cell/SPUThread.h @@ -1180,7 +1180,7 @@ public: reg_value0 = std::stoull(value.substr(16, 31), 0, 16); reg_value1 = std::stoull(value.substr(0, 15), 0, 16); } - catch (std::invalid_argument& e) + catch (std::invalid_argument& /*e*/) { return false; } diff --git a/rpcs3/Emu/DbgConsole.cpp b/rpcs3/Emu/DbgConsole.cpp index 59237c8789..0e534c952a 100644 --- a/rpcs3/Emu/DbgConsole.cpp +++ b/rpcs3/Emu/DbgConsole.cpp @@ -26,6 +26,11 @@ DbgConsole::~DbgConsole() { ThreadBase::Stop(); m_dbg_buffer.Flush(); + + safe_delete(m_console); + safe_delete(m_color_white); + safe_delete(m_color_red); + safe_delete(m_output); } void DbgConsole::Write(int ch, const std::string& text) diff --git a/rpcs3/Emu/FS/VFS.cpp b/rpcs3/Emu/FS/VFS.cpp index c3ae2dcd9c..0833c471b9 100644 --- a/rpcs3/Emu/FS/VFS.cpp +++ b/rpcs3/Emu/FS/VFS.cpp @@ -14,6 +14,11 @@ int sort_devices(const void* _a, const void* _b) return 0; } +VFS::~VFS() +{ + UnMountAll(); +} + void VFS::Mount(const std::string& ps3_path, const std::string& local_path, vfsDevice* device) { UnMount(ps3_path); @@ -46,8 +51,9 @@ void VFS::UnMountAll() for(u32 i=0; i m_devices; void Mount(const std::string& ps3_path, const std::string& local_path, vfsDevice* device); void UnMount(const std::string& ps3_path); diff --git a/rpcs3/Emu/GS/GL/GLFragmentProgram.cpp b/rpcs3/Emu/GS/GL/GLFragmentProgram.cpp index fab7222de8..7d1d064ef5 100644 --- a/rpcs3/Emu/GS/GL/GLFragmentProgram.cpp +++ b/rpcs3/Emu/GS/GL/GLFragmentProgram.cpp @@ -234,15 +234,6 @@ std::string GLFragmentDecompilerThread::BuildCode() p += m_parr.params[i].Format(); } - //return "#version 330\n\ -\n\ -out vec3 color;\n\ -in vec4 tc1;\n\ -\n\ -void main()\n\ -{\n\ - color = tc1.rgb;\n\ -}"; return std::string("#version 330\n" "\n" + p + "\n" @@ -353,7 +344,7 @@ void GLFragmentDecompilerThread::Task() GLShaderProgram::GLShaderProgram() : m_decompiler_thread(nullptr) - , id(0) + , m_id(0) { } @@ -374,11 +365,22 @@ GLShaderProgram::~GLShaderProgram() Delete(); } +void GLShaderProgram::Wait() +{ + if(m_decompiler_thread && m_decompiler_thread->IsAlive()) + { + m_decompiler_thread->Join(); + } +} + void GLShaderProgram::Decompile(RSXShaderProgram& prog) { -#if 0 - FragmentDecompilerThread(shader, parr, addr).Entry(); -#else + GLFragmentDecompilerThread decompiler(m_shader, m_parr, prog.addr, prog.size, prog.ctrl); + decompiler.Task(); +} + +void GLShaderProgram::DecompileAsync(RSXShaderProgram& prog) +{ if(m_decompiler_thread) { Wait(); @@ -391,59 +393,59 @@ void GLShaderProgram::Decompile(RSXShaderProgram& prog) m_decompiler_thread = nullptr; } - m_decompiler_thread = new GLFragmentDecompilerThread(shader, parr, prog.addr, prog.size, prog.ctrl); + m_decompiler_thread = new GLFragmentDecompilerThread(m_shader, m_parr, prog.addr, prog.size, prog.ctrl); m_decompiler_thread->Start(); -#endif } void GLShaderProgram::Compile() { - if(id) glDeleteShader(id); + if (m_id) glDeleteShader(m_id); - id = glCreateShader(GL_FRAGMENT_SHADER); + m_id = glCreateShader(GL_FRAGMENT_SHADER); - const char* str = shader.c_str(); - const int strlen = shader.length(); + const char* str = m_shader.c_str(); + const int strlen = m_shader.length(); - glShaderSource(id, 1, &str, &strlen); - glCompileShader(id); + glShaderSource(m_id, 1, &str, &strlen); + glCompileShader(m_id); - GLint r = GL_FALSE; - glGetShaderiv(id, GL_COMPILE_STATUS, &r); - if(r != GL_TRUE) + GLint compileStatus = GL_FALSE; + glGetShaderiv(m_id, GL_COMPILE_STATUS, &compileStatus); // Determine the result of the glCompileShader call + if (compileStatus != GL_TRUE) // If the shader failed to compile... { - glGetShaderiv(id, GL_INFO_LOG_LENGTH, &r); + GLint infoLength; + glGetShaderiv(m_id, GL_INFO_LOG_LENGTH, &infoLength); // Retrieve the length in bytes (including trailing NULL) of the shader info log - if(r) + if (infoLength > 0) { - char* buf = new char[r+1]; GLsizei len; - memset(buf, 0, r+1); - glGetShaderInfoLog(id, r, &len, buf); - ConLog.Error("Failed to compile shader: %s", buf); + char* buf = new char[infoLength]; // Buffer to store infoLog + + glGetShaderInfoLog(m_id, infoLength, &len, buf); // Retrieve the shader info log into our buffer + ConLog.Error("Failed to compile shader: %s", buf); // Write log to the console + delete[] buf; } - ConLog.Write(shader.c_str()); - Emu.Pause(); + ConLog.Write(m_shader.c_str()); // Log the text of the shader that failed to compile + Emu.Pause(); // Pause the emulator, we can't really continue from here } - //else ConLog.Write("Shader compiled successfully!"); } void GLShaderProgram::Delete() { - for(u32 i=0; i> 16; } }; -struct GLShaderProgram +/** Storage for an Fragment Program in the process of of recompilation. + * This class calls OpenGL functions and should only be used from the RSX/Graphics thread. + */ +class GLShaderProgram { +public: GLShaderProgram(); ~GLShaderProgram(); - GLFragmentDecompilerThread* m_decompiler_thread; - - GLParamArray parr; - - std::string shader; - - u32 id; - - void Wait() - { - if(m_decompiler_thread && m_decompiler_thread->IsAlive()) - { - m_decompiler_thread->Join(); - } - } + /** + * Decompile a fragment shader located in the PS3's Memory. This function operates synchronously. + * @param prog RSXShaderProgram specifying the location and size of the shader in memory + */ void Decompile(RSXShaderProgram& prog); + + /** + * Asynchronously decompile a fragment shader located in the PS3's Memory. + * When this function is called you must call Wait before GetShaderText() will return valid data. + * @param prog RSXShaderProgram specifying the location and size of the shader in memory + */ + void DecompileAsync(RSXShaderProgram& prog); + + /** Wait for the decompiler task to complete decompilation. */ + void Wait(); + + /** Compile the decompiled fragment shader into a format we can use with OpenGL. */ void Compile(); + /** Get the source text for this shader */ + inline const std::string& GetShaderText() const { return m_shader; } + + /** + * Set the source text for this shader + * @param shaderText supplied shader text + */ + inline void SetShaderText(const std::string& shaderText) { m_shader = shaderText; } + + /** Get the OpenGL id this shader is bound to */ + inline u32 GetId() const { return m_id; } + + /** + * Set the OpenGL id this shader is bound to + * @param id supplied id + */ + inline void SetId(const u32 id) { m_id = id; } + +private: + /** Threaded fragment shader decompiler responsible for decompiling this program */ + GLFragmentDecompilerThread* m_decompiler_thread; + + /** Shader parameter storage */ + GLParamArray m_parr; + + /** Text of our decompiler shader */ + std::string m_shader; + + /** OpenGL id this shader is bound to */ + u32 m_id; + + /** Deletes the shader and any stored information */ void Delete(); -}; \ No newline at end of file +}; diff --git a/rpcs3/Emu/GS/GL/GLGSRender.cpp b/rpcs3/Emu/GS/GL/GLGSRender.cpp index 4bc955627d..4c79809716 100644 --- a/rpcs3/Emu/GS/GL/GLGSRender.cpp +++ b/rpcs3/Emu/GS/GL/GLGSRender.cpp @@ -397,12 +397,11 @@ bool GLGSRender::LoadProgram() { ConLog.Warning("FP not found in buffer!"); m_shader_prog.Decompile(*m_cur_shader_prog); - m_shader_prog.Wait(); m_shader_prog.Compile(); checkForGlError("m_shader_prog.Compile"); wxFile f(wxGetCwd() + "/FragmentProgram.txt", wxFile::write); - f.Write(m_shader_prog.shader); + f.Write(m_shader_prog.GetShaderText()); } if(m_vp_buf_num == -1) @@ -433,7 +432,7 @@ bool GLGSRender::LoadProgram() { // TODO: This isn't working perfectly. Is there any better/shorter way to update the program m_vertex_prog.shader = program.vp_shader; - m_shader_prog.shader = program.fp_shader; + m_shader_prog.SetShaderText(program.fp_shader); m_vertex_prog.Wait(); m_vertex_prog.Compile(); checkForGlError("m_vertex_prog.Compile"); @@ -441,13 +440,13 @@ bool GLGSRender::LoadProgram() m_shader_prog.Compile(); checkForGlError("m_shader_prog.Compile"); glAttachShader(m_program.id, m_vertex_prog.id); - glAttachShader(m_program.id, m_shader_prog.id); + glAttachShader(m_program.id, m_shader_prog.GetId()); glLinkProgram(m_program.id); checkForGlError("glLinkProgram"); glDetachShader(m_program.id, m_vertex_prog.id); - glDetachShader(m_program.id, m_shader_prog.id); + glDetachShader(m_program.id, m_shader_prog.GetId()); program.vp_id = m_vertex_prog.id; - program.fp_id = m_shader_prog.id; + program.fp_id = m_shader_prog.GetId(); program.modified = false; } } @@ -456,7 +455,7 @@ bool GLGSRender::LoadProgram() } else { - m_program.Create(m_vertex_prog.id, m_shader_prog.id); + m_program.Create(m_vertex_prog.id, m_shader_prog.GetId()); checkForGlError("m_program.Create"); m_prog_buffer.Add(m_program, m_shader_prog, *m_cur_shader_prog, m_vertex_prog, *m_cur_vertex_prog); checkForGlError("m_prog_buffer.Add"); @@ -468,9 +467,9 @@ bool GLGSRender::LoadProgram() RSXDebuggerProgram program; program.id = m_program.id; program.vp_id = m_vertex_prog.id; - program.fp_id = m_shader_prog.id; + program.fp_id = m_shader_prog.GetId(); program.vp_shader = m_vertex_prog.shader; - program.fp_shader = m_shader_prog.shader; + program.fp_shader = m_shader_prog.GetShaderText(); m_debug_programs.push_back(program); } } diff --git a/rpcs3/Emu/GS/GL/GLGSRender.h b/rpcs3/Emu/GS/GL/GLGSRender.h index 2a236448c0..92993c346b 100644 --- a/rpcs3/Emu/GS/GL/GLGSRender.h +++ b/rpcs3/Emu/GS/GL/GLGSRender.h @@ -78,7 +78,6 @@ public: int format = tex.GetFormat() & ~(0x20 | 0x40); bool is_swizzled = !(tex.GetFormat() & CELL_GCM_TEXTURE_LN); - glPixelStorei(GL_PACK_ALIGNMENT, tex.m_pitch); char* pixels = (char*)Memory.GetMemFromAddr(GetAddress(tex.GetOffset(), tex.GetLocation())); char* unswizzledPixels; @@ -255,7 +254,9 @@ public: { if(!m_id || !tex.GetOffset() || !tex.GetWidth() || !tex.GetHeight()) return; - u32* alldata = new u32[tex.GetWidth() * tex.GetHeight()]; + const u32 texPixelCount = tex.GetWidth() * tex.GetHeight(); + + u32* alldata = new u32[texPixelCount]; Bind(); @@ -276,15 +277,15 @@ public: { wxFile f(name + ".raw", wxFile::write); - f.Write(alldata, tex.GetWidth() * tex.GetHeight() * 4); + f.Write(alldata, texPixelCount * 4); } - u8* data = new u8[tex.GetWidth() * tex.GetHeight() * 3]; - u8* alpha = new u8[tex.GetWidth() * tex.GetHeight()]; + u8* data = new u8[texPixelCount * 3]; + u8* alpha = new u8[texPixelCount]; u8* src = (u8*)alldata; u8* dst_d = data; u8* dst_a = alpha; - for(u32 i=0; i> 20; - tex.SetControl3(pitch, depth); + tex.SetControl3(depth, pitch); } break; @@ -325,6 +327,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3 case_16(NV4097_SET_TEXTURE_BORDER_COLOR,0x20): { } + break; case NV4097_SET_SURFACE_FORMAT: { diff --git a/rpcs3/Emu/GS/RSXThread.h b/rpcs3/Emu/GS/RSXThread.h index a840c03c49..7fd5e46bd3 100644 --- a/rpcs3/Emu/GS/RSXThread.h +++ b/rpcs3/Emu/GS/RSXThread.h @@ -6,6 +6,7 @@ #include "Emu/SysCalls/Callback.h" #include +#include // For tracking a list of used gcm commands enum Method { @@ -384,6 +385,8 @@ public: u8 m_begin_end; bool m_read_buffer; + std::set m_used_gcm_commands; + protected: RSXThread() : ThreadBase("RSXThread") @@ -538,6 +541,8 @@ public: m_cur_shader_prog = nullptr; m_cur_shader_prog_num = 0; + m_used_gcm_commands.clear(); + OnInit(); ThreadBase::Start(); } diff --git a/rpcs3/Emu/Io/PadHandler.h b/rpcs3/Emu/Io/PadHandler.h index d07c6026b7..e099e2ef37 100644 --- a/rpcs3/Emu/Io/PadHandler.h +++ b/rpcs3/Emu/Io/PadHandler.h @@ -204,6 +204,7 @@ protected: public: virtual void Init(const u32 max_connect)=0; virtual void Close()=0; + virtual ~PadHandlerBase() = default; void Key(const u32 code, bool pressed) { diff --git a/rpcs3/Emu/Memory/MemoryBlock.h b/rpcs3/Emu/Memory/MemoryBlock.h index c47fa04ca1..49446a2d86 100644 --- a/rpcs3/Emu/Memory/MemoryBlock.h +++ b/rpcs3/Emu/Memory/MemoryBlock.h @@ -43,6 +43,7 @@ struct MemBlockInfo : public MemInfo MemBlockInfo& operator =(MemBlockInfo &&other){ this->addr = other.addr; this->size = other.size; + if (this->mem) _aligned_free(mem); this->mem = other.mem; other.mem = nullptr; return *this; diff --git a/rpcs3/Emu/SysCalls/Modules.cpp b/rpcs3/Emu/SysCalls/Modules.cpp index 3633b642cc..b759960929 100644 --- a/rpcs3/Emu/SysCalls/Modules.cpp +++ b/rpcs3/Emu/SysCalls/Modules.cpp @@ -117,20 +117,45 @@ static const g_module_list[] = {0xf034, "cellSailRec"}, {0xf035, "sceNpTrophy"}, {0xf053, "cellAdecAt3multi"}, - {0xf054, "cellLibatrac3multi"}, + {0xf054, "cellLibatrac3multi"} }; struct _InitNullModules { + std::vector m_modules; + _InitNullModules() { for(auto& m : g_module_list) { - new Module(m.id, m.name); + m_modules.push_back(new Module(m.id, m.name)); + } + } + + ~_InitNullModules() + { + for (int i = 0; i < m_modules.size(); ++i) + { + delete m_modules[i]; } } } InitNullModules; +/** HACK: Used to delete SFunc objects that get added to the global static function array (g_static_funcs_list). + * The destructor of this static object gets called when the program shuts down. + */ +struct StaticFunctionListCleaner_t +{ + StaticFunctionListCleaner_t() {} + ~StaticFunctionListCleaner_t() + { + for (int i = 0; i < g_static_funcs_list.size(); ++i) + { + delete g_static_funcs_list[i]; + } + } +} StaticFunctionListCleaner; + bool IsLoadedFunc(u32 id) { for(u32 i=0; iSetName(g_modules[index][(u8)id]->GetName()); - delete g_modules[index][(u8)id]; + // delete g_modules[index][(u8)id]; g_modules[index][(u8)id] = module; } else { g_modules[index][(u8)id]->SetName(module->GetName()); - delete module; + // delete module; } } else @@ -325,6 +350,16 @@ Module::Module(u16 id, void (*init)(), void (*load)(), void (*unload)()) if(init) init(); } +Module::~Module() +{ + UnLoad(); + + for (int i = 0; i < m_funcs_list.size(); i++) + { + delete m_funcs_list[i]; + } +} + void Module::Load() { if(IsLoaded()) @@ -336,9 +371,9 @@ void Module::Load() { std::lock_guard lock(g_funcs_lock); - if(IsLoadedFunc(m_funcs_list[i].id)) continue; + if(IsLoadedFunc(m_funcs_list[i]->id)) continue; - g_modules_funcs_list.push_back(&m_funcs_list[i]); + g_modules_funcs_list.push_back(m_funcs_list[i]); } SetLoaded(true); @@ -353,7 +388,7 @@ void Module::UnLoad() for(u32 i=0; iid); } SetLoaded(false); @@ -367,9 +402,9 @@ bool Module::Load(u32 id) for(u32 i=0; iid == id) { - g_modules_funcs_list.push_back(&m_funcs_list[i]); + g_modules_funcs_list.push_back(m_funcs_list[i]); return true; } diff --git a/rpcs3/Emu/SysCalls/Modules.h b/rpcs3/Emu/SysCalls/Modules.h index 01eaad4e35..c940df2b58 100644 --- a/rpcs3/Emu/SysCalls/Modules.h +++ b/rpcs3/Emu/SysCalls/Modules.h @@ -1,8 +1,4 @@ #pragma once -#include "Modules/cellResc.h" -#include "Modules/cellPngDec.h" -#include "Modules/cellJpgDec.h" -#include "Modules/cellGifDec.h" #define declCPU PPUThread& CPU = GetCurrentPPUThread @@ -18,6 +14,11 @@ struct ModuleFunc , func(func) { } + + ~ModuleFunc() + { + safe_delete(func); + } }; struct SFuncOp @@ -34,6 +35,11 @@ struct SFunc std::vector ops; u64 group; u32 found; + + ~SFunc() + { + safe_delete(func); + } }; extern std::vector g_static_funcs_list; @@ -47,12 +53,14 @@ class Module void (*m_unload_func)(); public: - std::vector m_funcs_list; + std::vector m_funcs_list; Module(u16 id, const char* name); Module(const char* name, void (*init)(), void (*load)() = nullptr, void (*unload)() = nullptr); Module(u16 id, void (*init)(), void (*load)() = nullptr, void (*unload)() = nullptr); + ~Module(); + void Load(); void UnLoad(); bool Load(u32 id); @@ -115,7 +123,7 @@ public: template __forceinline void Module::AddFunc(u32 id, T func) { - m_funcs_list.emplace_back(id, bind_func(func)); + m_funcs_list.emplace_back(new ModuleFunc(id, bind_func(func))); } template diff --git a/rpcs3/Emu/SysCalls/Modules/cellFont.cpp b/rpcs3/Emu/SysCalls/Modules/cellFont.cpp index b8a16cb664..3933f2d789 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellFont.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellFont.cpp @@ -5,8 +5,9 @@ #include "stblib/stb_truetype.h" void cellFont_init(); +void cellFont_load(); void cellFont_unload(); -Module cellFont(0x0019, cellFont_init, nullptr, cellFont_unload); +Module cellFont(0x0019, cellFont_init, cellFont_load, cellFont_unload); // Font Set Types enum @@ -226,7 +227,7 @@ struct CCellFontInternal //Module cellFont } }; -CCellFontInternal* s_fontInternalInstance = new CCellFontInternal(); +CCellFontInternal* s_fontInternalInstance = nullptr; // Functions int cellFontInitializeWithRevision(u64 revisionFlags, mem_ptr_t config) @@ -899,8 +900,14 @@ void cellFont_init() cellFont.AddFunc(0xb015a84e, cellFontGetRevisionFlags); } +void cellFont_load() +{ + s_fontInternalInstance = new CCellFontInternal(); +} + void cellFont_unload() { - s_fontInternalInstance->m_bInitialized = false; - s_fontInternalInstance->m_bFontGcmInitialized = false; + // s_fontInternalInstance->m_bInitialized = false; + // s_fontInternalInstance->m_bFontGcmInitialized = false; + delete s_fontInternalInstance; } \ No newline at end of file diff --git a/rpcs3/Emu/SysCalls/Modules/cellFontFT.cpp b/rpcs3/Emu/SysCalls/Modules/cellFontFT.cpp index 9cc0210149..174e06e53d 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellFontFT.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellFontFT.cpp @@ -4,7 +4,9 @@ #include "cellFont.h" void cellFontFT_init(); -Module cellFontFT(0x001a, cellFontFT_init); +void cellFontFT_load(); +void cellFontFT_unload(); +Module cellFontFT(0x001a, cellFontFT_init, cellFontFT_load, cellFontFT_unload); struct CellFontLibraryConfigFT { @@ -33,7 +35,7 @@ struct CCellFontFTInternal } }; -CCellFontFTInternal* s_fontFtInternalInstance = new CCellFontFTInternal(); +CCellFontFTInternal* s_fontFtInternalInstance = nullptr; int cellFontInitLibraryFreeTypeWithRevision(u64 revisionFlags, mem_ptr_t config, u32 lib_addr_addr) { @@ -67,4 +69,14 @@ void cellFontFT_init() cellFontFT.AddFunc(0x7a0a83c4, cellFontInitLibraryFreeTypeWithRevision); cellFontFT.AddFunc(0xec89a187, cellFontFTGetRevisionFlags); cellFontFT.AddFunc(0xfa0c2de0, cellFontFTGetInitializedRevisionFlags); +} + +void cellFontFT_load() +{ + s_fontFtInternalInstance = new CCellFontFTInternal(); +} + +void cellFontFT_unload() +{ + delete s_fontFtInternalInstance; } \ No newline at end of file diff --git a/rpcs3/Emu/SysCalls/Modules/cellResc.cpp b/rpcs3/Emu/SysCalls/Modules/cellResc.cpp index 790053ff67..3b419e9799 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellResc.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellResc.cpp @@ -5,8 +5,9 @@ #include "cellResc.h" void cellResc_init(); +void cellResc_load(); void cellResc_unload(); -Module cellResc(0x001f, cellResc_init, nullptr, cellResc_unload); +Module cellResc(0x001f, cellResc_init, cellResc_load, cellResc_unload); // Error Codes enum @@ -71,7 +72,7 @@ struct CCellRescInternal }; -CCellRescInternal* s_rescInternalInstance = new CCellRescInternal(); +CCellRescInternal* s_rescInternalInstance = nullptr; // Extern Functions extern int cellGcmSetFlipMode(u32 mode); @@ -810,7 +811,13 @@ void cellResc_init() //cellResc.AddFunc(0xe0cef79e, cellRescCreateInterlaceTable); } +void cellResc_load() +{ + s_rescInternalInstance = new CCellRescInternal(); +} + void cellResc_unload() { - s_rescInternalInstance->m_bInitialized = false; + // s_rescInternalInstance->m_bInitialized = false; + delete s_rescInternalInstance; } diff --git a/rpcs3/Emu/SysCalls/Modules/cellUserInfo.cpp b/rpcs3/Emu/SysCalls/Modules/cellUserInfo.cpp index 3c0a541d56..088eaa1d1c 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellUserInfo.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellUserInfo.cpp @@ -30,6 +30,7 @@ int cellUserInfoGetStat(u32 id, mem_ptr_t stat) memset(name, 0, CELL_USERINFO_USERNAME_SIZE); stream->Read(name, CELL_USERINFO_USERNAME_SIZE); stream->Close(); + delete stream; stat->id = id; memcpy(stat->name, name, CELL_USERINFO_USERNAME_SIZE); diff --git a/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp b/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp index 77a71f81c7..c82b257c12 100644 --- a/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp @@ -24,6 +24,18 @@ struct sceNpTrophyInternalContext vfsStream* trp_stream; TROPUSRLoader* tropusr; + + sceNpTrophyInternalContext() + : trp_stream(nullptr), + tropusr(nullptr) + { + } + + ~sceNpTrophyInternalContext() + { + safe_delete(trp_stream); + safe_delete(tropusr); + } }; struct sceNpTrophyInternal @@ -132,8 +144,10 @@ int sceNpTrophyRegisterContext(u32 context, u32 handle, u32 statusCb_addr, u32 a return SCE_NP_TROPHY_ERROR_ILLEGAL_UPDATE; // Rename or discard certain entries based on the files found - char target [32]; - sprintf(target, "TROP_%02d.SFM", Ini.SysLanguage.GetValue()); + const size_t kTargetBufferLength = 31; + char target[kTargetBufferLength+1]; + target[kTargetBufferLength] = 0; + snprintf(target, kTargetBufferLength, "TROP_%02d.SFM", Ini.SysLanguage.GetValue()); if (trp.ContainsEntry(target)) { trp.RemoveEntry("TROPCONF.SFM"); @@ -150,7 +164,7 @@ int sceNpTrophyRegisterContext(u32 context, u32 handle, u32 statusCb_addr, u32 a // Discard unnecessary TROP_XX.SFM files for (int i=0; i<=18; i++) { - sprintf(target, "TROP_%02d.SFM", i); + snprintf(target, kTargetBufferLength, "TROP_%02d.SFM", i); if (i != Ini.SysLanguage.GetValue()) trp.RemoveEntry(target); } @@ -288,7 +302,7 @@ int sceNpTrophyUnlockTrophy(u32 context, u32 handle, s32 trophyId, mem32_t plati // TODO: There are other possible errors sceNpTrophyInternalContext& ctxt = s_npTrophyInstance.contexts[context]; - if (trophyId >= ctxt.tropusr->GetTrophiesCount()) + if (trophyId >= (s32)ctxt.tropusr->GetTrophiesCount()) return SCE_NP_TROPHY_ERROR_INVALID_TROPHY_ID; if (ctxt.tropusr->GetTrophyUnlockState(trophyId)) return SCE_NP_TROPHY_ERROR_ALREADY_UNLOCKED; diff --git a/rpcs3/Emu/SysCalls/SysCalls.cpp b/rpcs3/Emu/SysCalls/SysCalls.cpp index 958b69a7f3..a068fbab8b 100644 --- a/rpcs3/Emu/SysCalls/SysCalls.cpp +++ b/rpcs3/Emu/SysCalls/SysCalls.cpp @@ -13,7 +13,9 @@ namespace detail{ void default_syscall(); static func_caller *null_func = bind_func(default_syscall); -static func_caller* sc_table[1024] = +static const int kSyscallTableLength = 1024; + +static func_caller* sc_table[kSyscallTableLength] = { null_func, bind_func(sys_process_getpid), //1 (0x001) @@ -502,6 +504,24 @@ static func_caller* sc_table[1024] = null_func, null_func, null_func, bind_func(cellGcmCallback), //1024 }; +/** HACK: Used to delete func_caller objects that get allocated and stored in sc_table (above). +* The destructor of this static object gets called when the program shuts down. +*/ +struct SyscallTableCleaner_t +{ + SyscallTableCleaner_t() {} + ~SyscallTableCleaner_t() + { + for (int i = 0; i < kSyscallTableLength; ++i) + { + if (sc_table[i] != null_func) + delete sc_table[i]; + } + + delete null_func; + } +} SyscallTableCleaner_t; + void default_syscall() { declCPU(); diff --git a/rpcs3/Emu/SysCalls/lv2/SC_FileSystem.cpp b/rpcs3/Emu/SysCalls/lv2/SC_FileSystem.cpp index 52af35a547..a706c4700a 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_FileSystem.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_FileSystem.cpp @@ -94,7 +94,8 @@ int cellFsOpen(u32 path_addr, int flags, mem32_t fd, mem32_t arg, u64 size) { _oflags &= ~CELL_O_TRUNC; //truncate file before opening it as read/write - Emu.GetVFS().OpenFile(ppath, vfsWrite); + auto filePtr = Emu.GetVFS().OpenFile(ppath, vfsWrite); + delete filePtr; } o_mode = vfsReadWrite; break; @@ -110,6 +111,7 @@ int cellFsOpen(u32 path_addr, int flags, mem32_t fd, mem32_t arg, u64 size) if(!stream || !stream->IsOpened()) { + delete stream; sys_fs.Error("\"%s\" not found! flags: 0x%08x", ppath.c_str(), flags); return CELL_ENOENT; } diff --git a/rpcs3/Gui/DisAsmFrame.cpp b/rpcs3/Gui/DisAsmFrame.cpp index 997981bade..8bcb5b36f2 100644 --- a/rpcs3/Gui/DisAsmFrame.cpp +++ b/rpcs3/Gui/DisAsmFrame.cpp @@ -143,9 +143,9 @@ public: } else { - PPUDisAsm& dis_asm = *new PPUDisAsm(CPUDisAsm_DumpMode); + PPUDisAsm* dis_asm = new PPUDisAsm(CPUDisAsm_DumpMode); decoder = new PPUDecoder(dis_asm); - disasm = &dis_asm; + disasm = dis_asm; } } @@ -347,9 +347,9 @@ void DisAsmFrame::Dump(wxCommandEvent& WXUNUSED(event)) { case CPU_THREAD_PPU: { - PPUDisAsm& dis_asm = *new PPUDisAsm(CPUDisAsm_DumpMode); + PPUDisAsm* dis_asm = new PPUDisAsm(CPUDisAsm_DumpMode); decoder = new PPUDecoder(dis_asm); - disasm = &dis_asm; + disasm = dis_asm; } break; diff --git a/rpcs3/Gui/InterpreterDisAsm.cpp b/rpcs3/Gui/InterpreterDisAsm.cpp index 94038ddd47..596516b9bc 100644 --- a/rpcs3/Gui/InterpreterDisAsm.cpp +++ b/rpcs3/Gui/InterpreterDisAsm.cpp @@ -127,9 +127,9 @@ void InterpreterDisAsmFrame::OnSelectUnit(wxCommandEvent& event) { case CPU_THREAD_PPU: { - PPUDisAsm& dis_asm = *new PPUDisAsm(CPUDisAsm_InterpreterMode); + PPUDisAsm* dis_asm = new PPUDisAsm(CPUDisAsm_InterpreterMode); decoder = new PPUDecoder(dis_asm); - disasm = &dis_asm; + disasm = dis_asm; } break; diff --git a/rpcs3/Ini.cpp b/rpcs3/Ini.cpp index 28b8375084..42f94a3e62 100644 --- a/rpcs3/Ini.cpp +++ b/rpcs3/Ini.cpp @@ -159,6 +159,11 @@ Ini::Ini() #endif } +Ini::~Ini() +{ + safe_delete(m_Config); +} + void Ini::Save(const wxString& key, int value) { m_Config->Write(key, value); diff --git a/rpcs3/Ini.h b/rpcs3/Ini.h index a2a0da1d7c..a83c26f7bd 100644 --- a/rpcs3/Ini.h +++ b/rpcs3/Ini.h @@ -21,10 +21,14 @@ struct WindowInfo class Ini { +public: + virtual ~Ini(); + protected: wxConfigBase* m_Config; Ini(); + void Save(const wxString& key, int value); void Save(const wxString& key, bool value); void Save(const wxString& key, wxSize value); diff --git a/rpcs3/Loader/ELF.h b/rpcs3/Loader/ELF.h index 1c41cba251..cbb9d88473 100644 --- a/rpcs3/Loader/ELF.h +++ b/rpcs3/Loader/ELF.h @@ -48,7 +48,7 @@ public: Elf_Ehdr ehdr; ELFLoader(vfsStream& f); - ~ELFLoader() {Close();} + virtual ~ELFLoader() {Close();} virtual bool LoadInfo(); virtual bool LoadData(u64 offset = 0); diff --git a/rpcs3/Loader/Loader.h b/rpcs3/Loader/Loader.h index ca69ec408a..e630b7a947 100644 --- a/rpcs3/Loader/Loader.h +++ b/rpcs3/Loader/Loader.h @@ -191,6 +191,8 @@ protected: } public: + virtual ~LoaderBase() = default; + virtual bool LoadInfo() { return false; } virtual bool LoadData(u64 offset = 0) { return false; } Elf_Machine GetMachine() const { return machine; } @@ -208,7 +210,7 @@ class Loader : public LoaderBase public: Loader(); Loader(vfsFileBase& stream); - ~Loader(); + virtual ~Loader(); void Open(const std::string& path); void Open(vfsFileBase& stream); diff --git a/rpcs3/Loader/TROPUSR.cpp b/rpcs3/Loader/TROPUSR.cpp index 738e00ca46..756b9366eb 100644 --- a/rpcs3/Loader/TROPUSR.cpp +++ b/rpcs3/Loader/TROPUSR.cpp @@ -28,8 +28,7 @@ bool TROPUSRLoader::Load(const std::string& filepath, const std::string& configp LoadTableHeaders(); LoadTables(); - m_file->Close(); - m_file = NULL; + Close(); return true; } @@ -206,7 +205,7 @@ bool TROPUSRLoader::Close() { if (m_file && m_file->Close()) { - m_file = NULL; + safe_delete(m_file); return true; } return false; diff --git a/rpcs3/rpcs3.vcxproj b/rpcs3/rpcs3.vcxproj index 567d4346f6..8f754b11cd 100644 --- a/rpcs3/rpcs3.vcxproj +++ b/rpcs3/rpcs3.vcxproj @@ -1,6 +1,14 @@ - + + + Debug - MemLeak + Win32 + + + Debug - MemLeak + x64 + Debug Win32 @@ -30,12 +38,24 @@ Unicode v120 + + Application + true + Unicode + v120 + Application true Unicode v120 + + Application + true + Unicode + v120 + Application false @@ -58,9 +78,15 @@ + + + + + + @@ -74,12 +100,24 @@ ..\libs\$(Configuration)\;$(LibraryPath) $(ProjectName)-$(PlatformShortName)-dbg + + .\;..\wxWidgets\include;..\SDL-1.3.0-5538\include;..\SDL_image-1.2.10;..\pthreads-2.8.0;..\;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86\Include;.\OpenAL\include;$(IncludePath) + $(SolutionDir)bin\ + ..\libs\$(Configuration)\;$(LibraryPath) + $(ProjectName)-$(PlatformShortName)-dbg + .\;..\wxWidgets\include;..\SDL-1.3.0-5538\include;..\SDL_image-1.2.10;..\pthreads-2.8.0;..\;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;.\OpenAL\include;$(IncludePath) $(SolutionDir)bin\ ..\libs\$(Configuration)\;$(LibraryPath) $(ProjectName)-$(PlatformShortName)-dbg + + .\;..\wxWidgets\include;..\SDL-1.3.0-5538\include;..\SDL_image-1.2.10;..\pthreads-2.8.0;..\;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86_64\Include;.\OpenAL\include;$(IncludePath) + $(SolutionDir)bin\ + ..\libs\$(Configuration)\;$(LibraryPath) + $(ProjectName)-$(PlatformShortName)-dbg + false .\;..\wxWidgets\include;..\SDL-1.3.0-5538\include;..\SDL_image-1.2.10;..\pthreads-2.8.0;..\;..\ffmpeg\WindowsInclude;..\ffmpeg\Windows\x86\Include;.\OpenAL\include;$(IncludePath) @@ -119,6 +157,27 @@ + + + Level3 + Disabled + EditAndContinue + Use + true + ..\wxWidgets\include\msvc + + + true + wxmsw31ud_adv.lib;wxbase31ud.lib;wxmsw31ud_core.lib;wxmsw31ud_aui.lib;wxtiffd.lib;wxjpegd.lib;wxpngd.lib;wxzlibd.lib;odbc32.lib;odbccp32.lib;comctl32.lib;ws2_32.lib;shlwapi.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;avcodec.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib;OpenAL32.lib;EFX-Util.lib;%(AdditionalDependencies) + %(IgnoreSpecificDefaultLibraries) + false + ..\wxWidgets\lib\vc_lib;..\ffmpeg\Windows\x86\lib;..\OpenAL\Win32 + + + + + + Level3 @@ -141,6 +200,29 @@ false + + + Level3 + Disabled + ProgramDatabase + Use + ..\wxWidgets\include\msvc + _UNICODE;UNICODE;MSVC_CRT_MEMLEAK_DETECTION;%(PreprocessorDefinitions) + + + true + wxmsw31ud_adv.lib;wxbase31ud.lib;wxmsw31ud_core.lib;wxmsw31ud_aui.lib;wxtiffd.lib;wxjpegd.lib;wxpngd.lib;wxzlibd.lib;odbc32.lib;odbccp32.lib;comctl32.lib;ws2_32.lib;shlwapi.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;avcodec.lib;avformat.lib;avutil.lib;swresample.lib;swscale.lib;OpenAL32.lib;EFX-Util.lib;%(AdditionalDependencies) + %(IgnoreSpecificDefaultLibraries) + false + ..\wxWidgets\lib\vc_x64_lib;..\ffmpeg\Windows\x86_64\lib;..\OpenAL\Win64 + + + "$(SolutionDir)\Utilities\git-version-gen.cmd" + + + false + + TurnOffAllWarnings @@ -187,6 +269,7 @@ Speed Sync false + true Windows @@ -352,7 +435,9 @@ Create Create Create + Create Create + Create @@ -400,6 +485,7 @@ + diff --git a/rpcs3/rpcs3.vcxproj.filters b/rpcs3/rpcs3.vcxproj.filters index 86c028a9b9..9ff78c9308 100644 --- a/rpcs3/rpcs3.vcxproj.filters +++ b/rpcs3/rpcs3.vcxproj.filters @@ -1,4 +1,4 @@ - + @@ -978,5 +978,8 @@ Emu\SysCalls\Modules + + Emu\Cell + \ No newline at end of file diff --git a/rpcs3/rpcs3.vcxproj.user b/rpcs3/rpcs3.vcxproj.user index d7fe813d8f..b03467fb6a 100644 --- a/rpcs3/rpcs3.vcxproj.user +++ b/rpcs3/rpcs3.vcxproj.user @@ -4,6 +4,10 @@ $(SolutionDir)bin\ WindowsLocalDebugger + + $(SolutionDir)bin\ + WindowsLocalDebugger + $(SolutionDir)bin\ WindowsLocalDebugger @@ -12,8 +16,15 @@ $(SolutionDir)bin\ WindowsLocalDebugger + + $(SolutionDir)bin\ + WindowsLocalDebugger + $(SolutionDir)bin\ WindowsLocalDebugger + + false + \ No newline at end of file diff --git a/rpcs3/stdafx.h b/rpcs3/stdafx.h index c5ddeb1881..b8492794c4 100644 --- a/rpcs3/stdafx.h +++ b/rpcs3/stdafx.h @@ -1,5 +1,11 @@ #pragma once +#ifdef MSVC_CRT_MEMLEAK_DETECTION + #define _CRTDBG_MAP_ALLOC + #include + #include +#endif + #define NOMINMAX #ifndef QT_UI @@ -34,6 +40,15 @@ #include #endif +#ifdef MSVC_CRT_MEMLEAK_DETECTION + #ifdef _DEBUG + #ifndef DBG_NEW + #define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ ) + #define new DBG_NEW + #endif + #endif // _DEBUG +#endif // MSVC_CRT_MEMLEAK_DETECTION + #ifndef _WIN32 //hack, disabled //#define wx_str() ToStdString().c_str() diff --git a/wxWidgets b/wxWidgets index 6637946d55..143b52a764 160000 --- a/wxWidgets +++ b/wxWidgets @@ -1 +1 @@ -Subproject commit 6637946d55f41e8615c09fd202c6399017916e2b +Subproject commit 143b52a7645b140dff414f332b97f00444332bb9