MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / insert

Method insert

pcsx2/x86/BaseblockEx.h:77–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75 }
76
77 BASEBLOCKEX* insert(u32 startpc, uptr fnptr)
78 {
79 if (_Size + 1 >= _Reserved)
80 {
81 reserve(_Reserved + 0x2000); // some games requires even more!
82 }
83
84 // Insert the the new BASEBLOCKEX by startpc order
85 int imin = 0, imax = _Size, imid;
86
87 while (imin < imax)
88 {
89 imid = (imin + imax) >> 1;
90
91 if (blocks[imid].startpc > startpc)
92 imax = imid;
93 else
94 imin = imid + 1;
95 }
96
97 pxAssert(imin == _Size || blocks[imin].startpc > startpc);
98
99 if (imin < _Size)
100 {
101 // make a hole for a new block.
102 memmove(blocks + imin + 1, blocks + imin, (_Size - imin) * sizeof(BASEBLOCKEX));
103 }
104
105 memset((blocks + imin), 0, sizeof(BASEBLOCKEX));
106 blocks[imin].startpc = startpc;
107 blocks[imin].fnptr = fnptr;
108
109 _Size++;
110 return &blocks[imin];
111 }
112
113 __fi BASEBLOCKEX& operator[](int idx) const
114 {

Callers 15

vtlb_BackpatchLoadStoreFunction · 0.45
GetKeyValueListMethod · 0.45
loadMethod · 0.45
GetAllMyNumbersMethod · 0.45
GetOpticalDriveListFunction · 0.45
GetValidDriveFunction · 0.45
NewMethod · 0.45
LinkMethod · 0.45

Calls 1

reserveFunction · 0.50

Tested by

no test coverage detected