Skip to content

Commit f992ccd

Browse files
committed
cellGam/celCamera: Add more wait flags
1 parent e6dc0d9 commit f992ccd

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

rpcs3/Emu/Cell/Modules/cellCamera.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,8 +1139,10 @@ error_code cellCameraGetBufferInfo(s32 dev_num, vm::ptr<CellCameraInfo> info)
11391139
return CELL_OK;
11401140
}
11411141

1142-
error_code cellCameraGetBufferInfoEx(s32 dev_num, vm::ptr<CellCameraInfoEx> info)
1142+
error_code cellCameraGetBufferInfoEx(ppu_thread& ppu, s32 dev_num, vm::ptr<CellCameraInfoEx> info)
11431143
{
1144+
ppu.state += cpu_flag::wait;
1145+
11441146
cellCamera.notice("cellCameraGetBufferInfoEx(dev_num=%d, info=0x%x)", dev_num, info);
11451147

11461148
// calls cellCameraGetBufferInfo
@@ -1151,10 +1153,16 @@ error_code cellCameraGetBufferInfoEx(s32 dev_num, vm::ptr<CellCameraInfoEx> info
11511153
}
11521154

11531155
auto& g_camera = g_fxo->get<camera_thread>();
1154-
std::lock_guard lock(g_camera.mutex);
11551156

1156-
*info = g_camera.info;
1157+
CellCameraInfoEx info_out;
1158+
1159+
{
1160+
std::lock_guard lock(g_camera.mutex);
1161+
1162+
info_out = g_camera.info;
1163+
}
11571164

1165+
*info = info_out;
11581166
return CELL_OK;
11591167
}
11601168

rpcs3/Emu/Cell/Modules/cellGem.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2308,8 +2308,10 @@ error_code cellGemConvertVideoFinish(ppu_thread& ppu)
23082308
return CELL_OK;
23092309
}
23102310

2311-
error_code cellGemConvertVideoStart(vm::cptr<void> video_frame)
2311+
error_code cellGemConvertVideoStart(ppu_thread& ppu, vm::cptr<void> video_frame)
23122312
{
2313+
ppu.state += cpu_flag::wait;
2314+
23132315
cellGem.warning("cellGemConvertVideoStart(video_frame=*0x%x)", video_frame);
23142316

23152317
auto& gem = g_fxo->get<gem_config>();
@@ -2461,6 +2463,8 @@ error_code cellGemEnableMagnetometer2(u32 gem_num, u32 enable)
24612463

24622464
error_code cellGemEnd(ppu_thread& ppu)
24632465
{
2466+
ppu.state += cpu_flag::wait;
2467+
24642468
cellGem.warning("cellGemEnd()");
24652469

24662470
auto& gem = g_fxo->get<gem_config>();
@@ -3265,15 +3269,15 @@ error_code cellGemPrepareCamera(s32 max_exposure, f32 image_quality)
32653269

32663270
extern error_code cellCameraGetAttribute(s32 dev_num, s32 attrib, vm::ptr<u32> arg1, vm::ptr<u32> arg2);
32673271
extern error_code cellCameraSetAttribute(s32 dev_num, s32 attrib, u32 arg1, u32 arg2);
3268-
extern error_code cellCameraGetBufferInfoEx(s32 dev_num, vm::ptr<CellCameraInfoEx> info);
3272+
extern error_code cellCameraGetBufferInfoEx(ppu_thread&, s32 dev_num, vm::ptr<CellCameraInfoEx> info);
32693273

32703274
vm::var<CellCameraInfoEx> info = vm::make_var<CellCameraInfoEx>({});
32713275
vm::var<u32> arg1 = vm::make_var<u32>({});
32723276
vm::var<u32> arg2 = vm::make_var<u32>({});
32733277

32743278
cellCameraGetAttribute(0, 0x3e6, arg1, arg2);
32753279
cellCameraSetAttribute(0, 0x3e6, 0x3e, *arg2 | 0x80);
3276-
cellCameraGetBufferInfoEx(0, info);
3280+
cellCameraGetBufferInfoEx(*cpu_thread::get_current<ppu_thread>(), 0, info);
32773281

32783282
if (info->width == 640)
32793283
{
@@ -3605,6 +3609,8 @@ error_code cellGemTrackHues(vm::cptr<u32> req_hues, vm::ptr<u32> res_hues)
36053609

36063610
error_code cellGemUpdateFinish(ppu_thread& ppu)
36073611
{
3612+
ppu.state += cpu_flag::wait;
3613+
36083614
cellGem.warning("cellGemUpdateFinish()");
36093615

36103616
auto& gem = g_fxo->get<gem_config>();

0 commit comments

Comments
 (0)